IF NOT EXISTS ... INSERT


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. SET IDENTITY_INSERT dbo.UserGroup ON
  2.  
  3. IF NOT EXISTS (SELECT 1 FROM dbo.UserGroup WHERE UserGroupId = 21392)
  4. INSERT INTO dbo.UserGroup(UserGroupId, UserGroupTypeId, OwnerId, Name, Description, IsVisible)
  5. VALUES (21392, 1, 1, 'Anonymous Public Users', 'Anonymous Public Users', 0)
  6.  
  7. SET IDENTITY_INSERT dbo.UserGroup OFF

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.