DB primary key for the table and when there is no build another uniqueidentifier clustered index using NEWSEQUENTIALID () as the default value in order to generate the guid
Sometimes applications need to retrieve, after insert processing continues to guid generated, e.g., inserted into the other tables.
Variable declaration table, an ID is generated by reading the output inserted (here, the primary key is TableTest TestID)
declare @tb_id table(ID uniqueidentifier) insert into TableTest(Col1,Col2) OUTPUT INSERTED.TestID INTO @tb_id values('Col1Value','Col2Value') select ID from @tb_id