第一种:使用identity函数增加临时表的方法
Sql Server中自动序号的方法select id = identity(int,1,1),* into #tmp from table Sql Server中自动序号的方法select * from #tmp Sql Server中自动序号的方法drop table #tmp Sql Server中自动序号的方法
在SQL2005中新增了ROW_NUMBER()函数,给我们带来了很多方便,使用方法如下:
Sql Server中自动序号的方法SELECT id,ROW_NUMBER() OVER (order by id)as RowNumber FROM Table
有一个方便,as后的别名可以在语句后面作为条件单独使用.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-09-22
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
猜你喜欢
  • 2021-05-29
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-22
相关资源
相似解决方案