EXECUTE cannot be used as a source when inserting into a table variable.
Posted on 2004-10-15
I am getting an error in T-SQL while I am trying to get the results of one stored procedure into a table.
The code that gives error is,
DECLARE @RetTable TABLE(ReportHCEntityID int, DataElementID int, ElementValue varchar(50))
EXEC dbo.spSelectReportDataForMetric @MetricID, @DataElement1, @DataElement2
Where dbo.spSelectReportDataForMetric is another stored procedure. Does this mean I cannot do something like this. Do I have to use user defined functions?
I saw an example in SQL Server Online Books. I am trying to locate that example again. But I am pretty sure example was inserting result of execute into the table.
Thanks a lot