优米格
分享有营养的

SQL SERVER插入数据(主键列自增)

BraUndress.png

插入数据SQL示例:

SET IDENTITY_INSERT [dbo].[tb_peidang_rijihua] ON 

INSERT INTO [dbo].[tb_peidang_rijihua]([id], [chuangjianrenbianhao], [chuangjianshijian], [rijihuabianhao], [riqi], [xingqi], [xiugairenbianhao], [xiugaishijian], [zhibanbanzhangbianhao], [zhibanganbubianhao], [zhoujihuabianhao], [zhuangtai], [chufangzhiriyuanbianhao], [zhibantongxinyuanbianhao], [beiqingbianzubianhao], [zhiqingbianzubianhao]) VALUES ((SELECT ISNULL(MAX(id)+1,0) FROM dbo.tb_peidang_rijihua WITH(SERIALIZABLE, UPDLOCK)), '1a03f04a08e446b1a7193d06cf7be311', '2020-11-15 18:25:46.1910000', '27d9fe8a5c7644968251bfedf938eade', '2020-11-16', '星期一', NULL, NULL, '0de87873d93944f8b8c8b8215e966f6b', '1a03f04a08e446b1a7193d06cf7be311', '6bee9f5f6ce24ecd9a9088fb0873d33f', '1', '516c5fd26bdc46588dca51a16b7d1ecb', '0de87873d93944f8b8c8b8215e966f6b', '0f9714cd1db04e03baeba2b8f1aa9f1c', 'f7743dfd04ad43c9a421d8bf2d5582d3');

SET IDENTITY_INSERT [dbo].[tb_peidang_rijihua] OFF

其中id列为自增列。

赞(1)
未经允许禁止转载:优米格 » SQL SERVER插入数据(主键列自增)

评论 抢沙发

合作&反馈&投稿

商务合作、问题反馈、投稿,欢迎联系

广告合作侵权联系