I am working on sql server 2008.
And i have a stored procedure in which i am executing one more usp.
Here i want to get the output of second usp and return the main usp output parameter accordingly.
But my main usp always returning the second usp value with the main usp value.
But i want to return only main usp value.
Below is my procedure :
ALTER Proc [dbo].[usp_ChangeStatus](@id int,@Status int,@Name varchar(300),@Success int output )
as
set @Success=0
begin try
if exists(Select * from tbl_abc where id= @id)
Begin
if(@Status =1)
begin
----Try-Catch block----
begin try
declare @AddHostStatus as int
set @AddHostStatus=0
exec @AddHostStatus =usp_xyz @Name,0,@Address
if(@AddHostStatus=-3)
begin
set @Success=1
end
end try
begin catch
set @Success=0
end catch
----End-Try-Catch block----
end
if(@Success=1)
begin
--do something here
end
End
end try
begin catch
set @Success=0
end catch
select @Success