Is there a better way to retrieve unique ID upon INSERT?
- by Andy
Hi, I am using the following MS SQL statement to insert records and return the unique auto-inc ID value all in one shot. Wonder if there is a simpler/faster/better way to do it?
SET NOCOUNT ON;
DECLARE @res table (ID bigint);
INSERT INTO [Titles] ([Name],[Timestamp],[Title])
OUTPUT INSERTED.ID INTO @res
VALUES ('Name','23 aug 2010','this is a…