tommym121
asked on
SQL - How to make table result available to the calling script
I have to execut this statement, it will return result as a table. How can I make use of it
EXEC ('select ' + @columnsList + ', '+ @SQLValuesSetTemplate + 'as ValueSet From ' + @sourceTable)
EXEC ('select ' + @columnsList + ', '+ @SQLValuesSetTemplate + 'as ValueSet From ' + @sourceTable)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER
I try, I can not get it working. Would you be able to look at it what is missing?
DECLARE @str varchar(max)
Set @str=
'Select * from T1'
insert into #tempTable123
Exec (@str)
Print 'Hello' ;
Select * from #tempTable123
I got this error
Msg 208, Level 16, State 0, Line 5
Invalid object name '#tempTable123'.