Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to add record number in sqlserver
Message
 
 
À
21/07/2012 09:48:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01548942
Message ID:
01548954
Vues:
81
>in vfp i do :
>replace all myfield with recno()
>
>and the command re-number the field.
>
>how can i do it in sqlserver ?

In SQL 2005 and up look at ROW_NUMBER function, e.g.
;with cte as (select myfield, row_number() over (order by SomeField) as NewNumber from myTable)

update cte set myField = NewNumber
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform