我正在尝试从存储过程返回最后插入行的标识。
我的代码的简化版本如下所示:
CREATE PROCEDURE [sp_name]
@AuthorisationCode uniqueidentifier
AS
INSERT INTO [tablename]
([AuthorisationCode]
)
VALUES
(@AuthorisationCode
)
RETURN @@IDENTITY
GO
我通过 Enterprise library 4.1 中的 Execute Scalar 调用这个存储过程。
它返回空值。任何人都看到我做错了什么。