I am new to SQL Server. Working with version 2014.
I have a table with GUID as the key. I have an insert statement
IF NOT EXISTS (select guid from table)
insert into table (,,) values (,,);
In this case, the insert will work if the guid does not exist; if it exists, I need to generate a new guid and perform the insertion. This does not stop with just two levels. I need to check for every guid that is generated and then insert accordingly. How do I do this with a query or, in the worst case, a stored procedure?