SQL在查询中生成ID序列号方法
在查表时,方法如下:
依name排序后生成序列ID
select ROW_NUMBER() Over(order by name desc) as ID,* from test
在做into插入表时如下:
select identity(int,1,1) as ID,* into table1 from table
在查表时,方法如下:
依name排序后生成序列ID
select ROW_NUMBER() Over(order by name desc) as ID,* from test
在做into插入表时如下:
select identity(int,1,1) as ID,* into table1 from table