Hi, there,
I am looking for a little syntax help to get my stored procedure working.
Let's say I have this master sp called ud_m, and it calls two other sp, ud_m1, and ud_m2 from within. Each returns a singular value, and has its own logic for extracting the right data.
I am down to last step of retrieving the data from ud_m by calling it from the app(ssms for now).
Here is the sample code:
create procedure [dbo].[ud_m1]
as
begin
select 'val2'
end
go
create procedure [dbo].[ud_m2]
as
begin
select 'val1'
end
go
--this returns just fine
exec [dbo].[ud_m1]
exec [dbo].[ud_m2]
create procedure [dbo].[ud_m]
@out as varchar(100) output
as
begin
declare @Val1 varchar (10)
declare @Val2 varchar (10)
--do not want this next two to output directly, however they showed up anyway.
exec @Val1 = [dbo].[ud_m1]
exec @Val2 = [dbo].[ud_m2]
--this part is for outout to calling app
--Select @Val1 , @Val2
Select @out = @Val1 + @Val2
end
go
declare @out as varchar(100)
exec [dbo].[ud_m] @out output
Select @out
--got
val2
val1
00
--I don't want line1 val2 and line 2 val1, but I do want 00 to be 'val2, val1', or 'val2val1'
drop procedure [dbo].[ud_m1]
drop procedure [dbo].[ud_m2]
drop procedure [dbo].[ud_m]
Thanks!