Insert with output

This can be an 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