当前位置:网站首页>SQL server generates auto increment sequence number

SQL server generates auto increment sequence number

2022-07-06 22:27:00 Maple Leaf pear flower

Docking with other systems SQL Server Data sheet of , Some tables have no primary key , Then you need to generate a self incrementing sequence number . Then use the following method

select ROW_NUMBER() OVER(ORDER BY GETDATE()) as xh  from  test

ROW_NUMBER() OVER(ORDER BY GETDATE()) Time can be grouped and sorted , The result set will be generated after execution ,select These result sets will be numbered ( Every result set starts from 1 Numbered starting ).

原网站

版权声明
本文为[Maple Leaf pear flower]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207061428034437.html