Skip to content
Advertisement

INSERT INTO if not exists SQL server

I have a database structured as follows:

users

group

user_groups

The first time a user logs in I would like their info to be added to the users table. So essentially the logic I would like to have if

How can I do this intelligently using SQL Server/C# ?

Advertisement

Answer

Or using the new MERGE syntax:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement