Sql 返回nvarchar(userId)的存储过程
我创建了一个存储过程,用于在接收到令牌和令牌类型时返回用户标识 存储过程如下所示:Sql 返回nvarchar(userId)的存储过程,sql,sql-server,database,stored-procedures,Sql,Sql Server,Database,Stored Procedures,我创建了一个存储过程,用于在接收到令牌和令牌类型时返回用户标识 存储过程如下所示: CREATE PROCEDURE [dbo].[UserTokens_Insert] ( @userId nvarchar(128) OUT ,@tokenType int ,@token uniqueidentifier ) AS /* Execution example proc I'm working on... DECLARE @use
CREATE PROCEDURE [dbo].[UserTokens_Insert]
(
@userId nvarchar(128) OUT
,@tokenType int
,@token uniqueidentifier
)
AS
/* Execution example
proc I'm working on...
DECLARE @userId nvarchar(128)
DECLARE @tokenType INT
DECLARE @token uniqueidentifier
'1415926535897932384626433832795',
'2',
'84384121-cac4-41f7-9bb9-8983b8c3ebb8'
execute [dbo].[UserTokens_Insert] @userId, @tokenType, @token
*/
BEGIN
SELECT [userId]
FROM [dbo].[UserTokens]
WHERE [UserId] = @userId
AND [TokenType] = @tokenType
AND [Token] = @token
EXECUTE dbo.UserToken_Insert @tokenType, @token, @userId out
它在最后一行中显示错误。我在其他程序中使用相同的东西,没有问题
这里有什么问题?您的过程采用的参数顺序与您在EXECUTE调用中传递参数的顺序不同
@userId, @tokenType, @token
@tokenType, @token, @userId
可能只是输入错误-但是1您的过程缺少一个结尾,2该过程被称为[UserTokens_Insert],但是执行调用[UserTokens_Insert],而没有标记上的s