I am inserting into a remote table and need to get the identity value that was last created i.e.
insert into [RemoteServer].[RemoteDatabase].dbo.[DB](num)
declare @id int
set @id = @@identity
This is returning NULL for the identity value but works fine if I run it on the server locally.
Does anyone know how to pick up the identity value?