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 like:
(1, …)
(2, …)
(3, …)
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.