No Edge Software
  • Search results
No Edge Software

Insert with output

This can be a better alternative to things like SCOPE_IDENTITY() or @@IDENTITY.

declare @result table (ID int);

-- dbo.Records has identity column ID
insert dbo.Records (PersonName)
output inserted.ID into @result
values (@PersonName);

select ID from @result; -- The newly created identity

Author

Joe Enos