Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assure this is done in the ascending identity sequence
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01105553
Message ID:
01108368
Vues:
15
Mike,

Do you know ahead of time what the ItemNo that was deleted? If so a single update statement could do it:
update orderfl
   set itemno = itemno - 1
   where invfld = 2414629 and itemno > @DeletedItemNo


>I have an order table that contains the line items of our orders. This table has two fields itemno ( sequence that line items where entered ) and the table orderflid ( identity field ).
>When an line is removed from the middle, I would like to renumber the ItemNo in order of identity field with out using a dowhile.
>
>I’m using this syntax:
>
>declare @itemno int
>set @Itemno = 0
>update orderfl set @Itemno = @Itemno + 1, itemno = @Itemno
>where invflid = 2414629
>
>
>How can I assure this is done in the ascending identity sequence ( 1st to last ).
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform