开发者

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:

(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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜