create proc login
(@id int out,
@email varchar(30),
@passsword varchar(30),
@type varchar(30) out)
as
begin
select
@id = id, @type = type
from
registration
where
email = @email
and password = @password
return 0
end
else
begin
return 1
end
Presumably, you are looking for this:
create procedure usp_login (
@email varchar(30),
@passsword varchar(30),
@id int output,
@type varchar(30) output
) as
begin
set @id = NULL;
select @id = id, @type = type
from registration
where email = @email and password = @password;
return (case when @id is null then 0 else 1 end);
end;
Some notes:
else
-- as mentioned in the comments -- requires an if
.output
arguments the last arguments. This is a matter of preference. However, I think it is good practice to keep all inputs together and all outputs together -- unless you have a good reason.