How to get multiple output parameters value from stored procedureI am writing stored procedure for login in which i want result through integer output parameters usertype and loginstatus as 1 and 1 respectively.
Following is stored procedure code:
CREATE procedure [dbo].[usp_login]
(@userid nvarchar(50), @password nvarchar(50), @usertype int output, @loginstatus int output)
if exists(Select COUNT(User_Id) from User_Master where User_Id = @userid and Password = @password)
select @usertype = User_Type from User_Master where User_Id = @userid and Password = @password;
set @loginstatus = 1;
set @usertype = 0
set @loginstatus = 0;
I am executing the sp in ssms as follows:
declare @usrtype int;
declare @lgnstat int;
exec usp_login 'a', 'a', @usrtype output, @lgnstat output
Now when i pass correct userid password i get result as 1,1 which is as expected.
But, when i pass wrong userid or password i get result as 1 which is expected as 0,0.
Please tell me where's the problem either in sp definition code or execution code.