[SQL] requete de mise à jour

Dinbougre Messages postés 48 Date d'inscription mercredi 11 octobre 2000 Statut Membre Dernière intervention 22 juin 2005 - 22 janv. 2002 à 12:01
Dinbougre Messages postés 48 Date d'inscription mercredi 11 octobre 2000 Statut Membre Dernière intervention 22 juin 2005 - 22 janv. 2002 à 18:04
voilà ma table:
PARAMETRE(obj_id, type, val1)

g certaines lignes ki ont donc un obj_id et plusieurs ki n'en ont pas
je veux prendre le maximum des obj_id et ensuite affecté a la 1ere ligné dont obj_id IS NULL la valeur du max(obj_id)+1 et ainsi de suite jusqu'a la fin comment faire?

SELECT MAX(OBJ_ID) FROM PARAMETRE

2 réponses

cs_asd Messages postés 32 Date d'inscription mercredi 9 janvier 2002 Statut Membre Dernière intervention 5 novembre 2003
22 janv. 2002 à 17:08
au lieu de faire un select xxx from xxx where xxx, essaie plutôt de faire un UPDATE xxx where xxx

Voici un exemple pour un enregistrement défini, mais à voir pour le faire tourner dans une boucle de type "For each .....

Exemple:
Dim sSqlPerso as StringsSqlPerso "UPDATE PERSONNEL SET PERSONNEL.MATRIC """ & MATRIC.Text & """, PERSONNEL.PRENOM = """ & PRENOM.Text & """, PERSONNEL.DATNAI = """ & Format(DATNAI.Value, "dd/mm/yyyy") & """, PERSONNEL.DATENT = """ & Format(DATENT.Value, "dd/mm/yyyy") & """, PERSONNEL.DATSOR = """ & Format(DATSOR.Value, "dd/mm/yyyy") & """, PERSONNEL.SEXE = """ & SEXE.Text & """, PERSONNEL.QUALIF = """ & QUALIF.Text & """, PERSONNEL.HIERAR = """ & ImgCboHIERAR.SelectedItem.Text & """, PERSONNEL.ID_SITE = """ & Mid(ImgCboSite.SelectedItem.Key, 2) & """, PERSONNEL.ISERVICE = """ & Mid(ImgCboService.SelectedItem.Key, 2) & """, PERSONNEL.USERMODIFICATION = """ & gsLogin & """, PERSONNEL.DATEHEUREMODIFICATION = '" & Date & " " & Time & "' WHERE PERSONNEL.MATRIC = " & MATRIC.Text & ";"

A++
asd
0
Dinbougre Messages postés 48 Date d'inscription mercredi 11 octobre 2000 Statut Membre Dernière intervention 22 juin 2005
22 janv. 2002 à 18:04
wahou :)
merci bcp je v essayer
0
Rejoignez-nous