无法执行此功能,我收到错误:
必须声明表变量“@Handle”。
函数定义:
CREATE FUNCTION [dbo].[FnGetHandle]()
RETURNS INT
AS
BEGIN
DECLARE @Handle AS INT;
DECLARE @strUser AS NCHAR(256);
SET @Handle = 0;
SET @strUser = CURRENT_USER;
INSERT INTO tbl_handle
Output Handle
INTO @Handle ( UserName )
VALUES ( @strUser );
RETURN @Handle
END
表定义:
tbl_handle 定义(句柄 int 身份、用户名 nvarchar、创建日期)