How to create a temp table based on number of columns?
for example if count is 20 create a temp table with 20 columns (all are nvarchar types).
If count is 10, then create temp table with 10 columns only.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you REALLY REALLY want to do this as written, you can use dynamic SQL like below:
Just put the outputted SQL string into another window, or if you trust it you can change the
SELECTto anEXEC.