Larry Brister
asked on
MS SQL Server join on Table and strored procedure results
I have a very good solution from another expert that does a dynamic sql and returns a variable number of columns based on other input.
I placed that solution in a storedprocedure
Is there a way to do a select on a table with a join to the output from the stored procedure
If I knew the columns I could create table #temp
and insert into it with an exe on the procedure
But the variable length nature of the response precludes that
I placed that solution in a storedprocedure
Is there a way to do a select on a table with a join to the output from the stored procedure
If I knew the columns I could create table #temp
and insert into it with an exe on the procedure
But the variable length nature of the response precludes that
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sure, but due to the scope, you need to create it before you call the procedure.. so it won't work.
ASKER
Well just for grins
How would I create that table?
I will be awarding points shortly
How would I create that table?
I will be awarding points shortly
By creating a "temporary table", thus creating a normal table in tempdb using the same dynamic approach for the columns as for creating your pivot.
ASKER
Thanks
ASKER
DECLARE @cols VARCHAR(MAX);
SELECT @cols = ISNULL(@cols + ',', '') + '[' + QuestionType + ']'
FROM vwPromotionSurveyIndividua
GROUP BY QuestionType;