--如果AA能区分大小 select id = (select count(1) from tb where aa < t.aa) + 1 , * from tb t
--如果aa+bb+cc能区分大小 select id = (select count(1) from tb where aa < t.aa or (aa=t.aa and bb <t.bb) or (aa=t.aa and bb=t.bb and cc <t.cc)) + 1 , * from tb t
1、select id=identity(int,128,1),aa,bb,cc into test from table1 --新建立表testdroptable table1 --删除表table1EXEC sp_rename 'test', 'table1'--更改表名称为table12、altertable table1 add ID intidentity(128,1)