I want to pass the id of the last inserted tuple in the stored procedure as an argument to another stored procedure.
Here are four snippets of code. The first two snippets works correctly:
declare @s bigint
select @s = scope_identity()
exec some_stored_proc @s
and
exec some_stored_proc scope_identity
But both these snippets cause query complete with errors:
declare @s bigint
select @s = scope_identity
and
exec some_stored_proc scope_identity()
I can't figure out what's the fuss with the brackets! How can scope_identity()
have different syntax?