February 1, 2011 at 4:06 am
Hello,
how to change the code to make UNION between the results of the two exec's
and the result to have two rows (one with 1 and the 2nd with 2)
declare @s1 as varchar(100)
declare @s2 as varchar(100)
set @s1 = 'SELECT 1'
set @s2 = 'SELECT 2'
exec( @s1 )
UNION
exec( @s2 )
Thanks,
Regards
February 1, 2011 at 4:14 am
Create a temp table, use Insert ... EXEC to insert the output of the procedures into the table, then query the table.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
February 1, 2011 at 4:27 am
What about this...
exec ( @s1+ ' UNION '+ @s2 )
February 1, 2011 at 8:07 am
Thanks a lot.
About:
What about this...
exec ( @s1+ ' UNION '+ @s2 )
that is nice, I have not thought about it. Unfortunately this query string is a sample, the real one is more complex.
I created a stored procedure that inserts records and another one that merges them all.
Have a great day,
Iulian
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy