欢迎来到思维库

思维库

SQL Server自增ID值不连续记录的实现方法

时间:2025-11-03 12:25:04 出处:人工智能阅读(143)

SQL Server自增ID值不连续记录的实现方法
复制if exists (select * from sysobjects  where id = OBJECT_ID([t_IDNotContinuous])  and OBJECTPROPERTY(id,自增ID值 IsUserTable) = 1)    DROPTABLE [t_IDNotContinuous]   CREATETABLE [t_IDNotContinuous] (   [ID] [int]  IDENTITY (1, 1)  NOTNULL,   [ValuesString] [nchar]  (10) NULL)   SET IDENTITY_INSERT [t_IDNotContinuous] ON INSERT [t_IDNotContinuous] ([ID],[ValuesString]) VALUES ( 1,test)   INSERT [t_IDNotContinuous] ([ID],[ValuesString]) VALUES ( 2,test)   INSERT [t_IDNotContinuous] ([ID],[ValuesString]) VALUES ( 3,test)   INSERT [t_IDNotContinuous] ([ID],[ValuesString]) VALUES ( 5,test)   INSERT [t_IDNotContinuous] ([ID],[ValuesString]) VALUES ( 6,test)   INSERT [t_IDNotContinuous] ([ID],[ValuesString]) VALUES ( 7,test)   INSERT [t_IDNotContinuous] ([ID],[ValuesString]) VALUES ( 10,test)   SET IDENTITY_INSERT [t_IDNotContinuous] OFF select * from [t_IDNotContinuous]  1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.

分享到:

温馨提示:以上内容和图片整理于网络,仅供参考,希望对您有帮助!如有侵权行为请联系删除!

友情链接: