当前位置:网站首页>SQL Server生成自增序号
SQL Server生成自增序号
2022-07-06 14:28:00 【枫叶梨花】
在对接其他系统的SQL Server的数据表的时候,有些表没有主键,然后需要产生一个自增序号。然后使用以下方式
select ROW_NUMBER() OVER(ORDER BY GETDATE()) as xh from test
ROW_NUMBER() OVER(ORDER BY GETDATE())
可以对时间进行分组及排序,执行后将会产生结果集,select会对这些结果集进行编号(每一个结果集都从1开始编号)。
边栏推荐
- Attack and defense world ditf Misc
- Qt | UDP广播通信、简单使用案例
- 墨西哥一架飞往美国的客机起飞后遭雷击 随后安全返航
- Codeforces Round #274 (Div. 2) –A Expression
- GPS from getting started to giving up (19), precise ephemeris (SP3 format)
- Chapter 3: detailed explanation of class loading process (class life cycle)
- 中国固态氧化物燃料电池技术进展与发展前景报告(2022版)
- Management background --5, sub classification
- 第3章:类的加载过程(类的生命周期)详解
- Oracle-控制文件及日志文件的管理
猜你喜欢
[MySQL] online DDL details
Crawler obtains real estate data
Search element topic (DFS)
Write a rotation verification code annotation gadget with aardio
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
Adjustable DC power supply based on LM317
GPS从入门到放弃(十六)、卫星时钟误差和卫星星历误差
Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案
The nearest common ancestor of binary (search) tree ●●
硬件开发笔记(十): 硬件开发基本流程,制作一个USB转RS232的模块(九):创建CH340G/MAX232封装库sop-16并关联原理图元器件
随机推荐
Report on technological progress and development prospects of solid oxide fuel cells in China (2022 Edition)
Attack and defense world miscall
小程序系统更新提示,并强制小程序重启并使用新版本
Wechat red envelope cover applet source code - background independent version - source code with evaluation points function
GPS du début à l'abandon (XIII), surveillance autonome de l'intégrité du récepteur (raim)
C # réalise la liaison des données du rapport Crystal et l'impression du Code à barres 4
[10:00 public class]: basis and practice of video quality evaluation
基于LM317的可调直流电源
Mongodb (III) - CRUD
GPS from getting started to giving up (19), precise ephemeris (SP3 format)
C # realizes crystal report binding data and printing 4-bar code
i.mx6ull搭建boa服务器详解及其中遇到的一些问题
中国1,4-环己烷二甲醇(CHDM)行业调研与投资决策报告(2022版)
GPS从入门到放弃(十六)、卫星时钟误差和卫星星历误差
Anaconda installs third-party packages
Unity3D学习笔记6——GPU实例化(1)
11、 Service introduction and port
每日一题:力扣:225:用队列实现栈
AI 企业多云存储架构实践 | 深势科技分享
Force deduction question 500, keyboard line, JS implementation