johnnyg123
asked on
Create temp table using dynamic sql
I have a stored procedure in which I need to create a single temp table based on one of several views
Each of the views has a differing amount of fields
I will use this table to turn around and generate a csv file
Is there a way to put the view name into a variable and use that variable value to create the temp table?
Each of the views has a differing amount of fields
I will use this table to turn around and generate a csv file
Is there a way to put the view name into a variable and use that variable value to create the temp table?
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Wait. Is the OP asking for a dynamic way to create a temp table based on 1 view ? That's how I read it. If that's not the case, then please disregard my earlier answer.
Hmm .. looks like we'll need a clarification, as I interpreted it as multiple views, which after a second reading may not be correct.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks for all the posts!
After rereading my question I realized I was indeed unclear
I wanted to give at least some points to all posts
Ultimately scott's suggestion is the one I went with so I give him the most
After rereading my question I realized I was indeed unclear
I wanted to give at least some points to all posts
Ultimately scott's suggestion is the one I went with so I give him the most