I'm trying to use the store procedure DynamicForms_ExportFormResults to save form results to a temp table that I can query for reporting.
At the end of the SP is:
Set @SQLToExecute = Convert(varchar(8000), @SQLToUse) + Convert(varchar(8000), @SQLToUseJoin)
--set @SQLToExecute = @SQLToUse + @SQLToUseJoin --print @SQLToExecute
EXEC(@SQLToExecute);
I thought I could just create the temp table, then insert the results of the query.
Something like this:
Create Table #Results Insert into #Results EXEC(@SQLToExecute); Select * from #Results
This obviously doesn't work, but I can't wrap my head around how to get it to work.
Your help is appreciated. |