[CODE=sql]create procedure [sp_LoginUser]
--inputparameter------------------------------------------------------------------------------
@User_id varchar(50) ,
@SendPassword varchar(50) ,
@Schema_name varchar(50) ,
@dbpassword varchar(15) output,
@Department varchar(20) output
as
declare @sql Nvarchar(300);
declare @id int;
begin transaction
set @sql=N'select dbpassword=Pass word,id=id from '+ @Schema_name+'. Users where Username='+@Use r_id ;
exec sp_executesql @sql
set @Department=(se lect Department from Agent_departmen t where id=@id);
commit transaction[/CODE]
this is not the complete code what i want is .
i want that dbpassword should fetch password from table and then using the if condition dbpassword will be checked with the password send under the procedure .if both the password matches it will check other table for department and department field will be returned to UI.
Please help how can this be done .
what i wrote previously was
[CODE=sql]create procedure sp_LoginUser
--inputparameter------------------------------------------------------------------------------
@User_id varchar(50) = null ,
@SendPassword varchar(50) = null,
@Schema_name varchar(50) = null,
@dbpassword varchar(15)=nul l output,
@Department varchar(20)=nul l output,
@verify bit output
as
declare @sql Nvarchar(300);
declare @id int;
begin transaction
set @sql=N'select @dbpassword=Pas sword,@id=id from '+ @Schema_name+'. Users where Username='+@Use r_id ;
exec sp_executesql @sql;
if (@dbpassword=@S endPassword)
begin
set @Department=(se lect Department from TRAVELSHOPERP.A gent_department where id=@id);
set @verify=1;
end
else
begin
set @verify=0;
end
commit transaction[/CODE]
--inputparameter------------------------------------------------------------------------------
@User_id varchar(50) ,
@SendPassword varchar(50) ,
@Schema_name varchar(50) ,
@dbpassword varchar(15) output,
@Department varchar(20) output
as
declare @sql Nvarchar(300);
declare @id int;
begin transaction
set @sql=N'select dbpassword=Pass word,id=id from '+ @Schema_name+'. Users where Username='+@Use r_id ;
exec sp_executesql @sql
set @Department=(se lect Department from Agent_departmen t where id=@id);
commit transaction[/CODE]
this is not the complete code what i want is .
i want that dbpassword should fetch password from table and then using the if condition dbpassword will be checked with the password send under the procedure .if both the password matches it will check other table for department and department field will be returned to UI.
Please help how can this be done .
what i wrote previously was
[CODE=sql]create procedure sp_LoginUser
--inputparameter------------------------------------------------------------------------------
@User_id varchar(50) = null ,
@SendPassword varchar(50) = null,
@Schema_name varchar(50) = null,
@dbpassword varchar(15)=nul l output,
@Department varchar(20)=nul l output,
@verify bit output
as
declare @sql Nvarchar(300);
declare @id int;
begin transaction
set @sql=N'select @dbpassword=Pas sword,@id=id from '+ @Schema_name+'. Users where Username='+@Use r_id ;
exec sp_executesql @sql;
if (@dbpassword=@S endPassword)
begin
set @Department=(se lect Department from TRAVELSHOPERP.A gent_department where id=@id);
set @verify=1;
end
else
begin
set @verify=0;
end
commit transaction[/CODE]
Comment