只有在没有插入行的情况下才插入行
INSERT INTO TheTableSELECT @primaryKey, @value1, @value2WHERE NOT EXISTS (SELECT NULL FROM TheTable WHERE PrimaryKey = @primaryKey)
INSERT INTO TheTableWITH (HOLDLOCK, UPDLOCK, ROWLOCK)SELECT @primaryKey, @value1, @value2WHERE NOT EXISTS (SELECT NULL FROM TheTable WITH (HOLDLOCK, UPDLOCK, ROWLOCK) WHERE PrimaryKey = @primaryKey)
慕桂英4014372
相关分类