Database Identity + PrimaryKey field forcibly inserted processing

xiaoxiao2021-03-06  65

Since it is Identity, you need to discard the Identity property when you force insert, and then pick the Identity property after inserting. Dight below

Set Identity_Insert [TableName] ON

INSERT INTO [TableName] (ID, Col1, Col2) Values ​​(0, Colvalue1, Colvalue2)

Set Identity_Insert [TableName] OFF

转载请注明原文地址:https://www.9cbs.com/read-85455.html

New Post(0)