I am trying to return identity of last inserted row from a stored procedure.
A simplified version of my code looks like this:
CREATE PROCEDURE [sp_name]
@AuthorisationCode uniqueidentifier
AS
INSERT INTO [tablename]
([AuthorisationCode]
)
VALUES
(@AuthorisationCode
)
RETURN @@IDENTITY
GO
I am calling this stored procedure via Execute Scalar in Enterprise library 4.1.
It returns null. Anybody see what I am doing wrong.