How to put squence number in a new column in one sql statement
Suppose I have a table(col1, col2, ...) with many legacy data. Then I add a new column myID
to this table. Then I want to put numbers like 1,2,3,... to this column so that the table data looks开发者_如何学C like:
After that I want to change this column myID to identity column
How would I use SQL to do this without writing a stored procedure using cursor?
You can put it as identity when you create it and MSSQL will do the rest.
精彩评论