tsql - How to user previous resultset into next query in SQL Server -
i want generate access token if username , password match in users table. how can use previous returned value next insert query? have marked missing value ###i don't know###.
create procedure [dbo].[getaccesstoken] @userid varchar(50), @password varchar(50) select id users userid = @userid , password = @password if @@rowcount != 0 begin set @token = newid(); insert accesstokens (token, userid) values(convert(varchar(255), @token), ###i don't know###) end return 0 end
please me. thanks, in advance.
simply pass @userid
second parameter insert
insert accesstokens (token, userid) values(convert(varchar(255), @token), @userid)
Comments
Post a Comment