Column name passed in as a parameter

  • Ok, it works perfectly now.  Thank you all so much.  I started to read the first article but didn't get far enough, will finish it tonight.  Thanks again, appreciate it.

  • Ninja, thank you again for sending those article links. I did get about halfway through the first one last night.  I should have read it before posting all this, is my face red!  This is what I learned:  "You can't specify a table name through a variable in T-SQL, that's the whole story. Thus, when you need to specify things like table names, column names etc dynamically, you must interpolate them into the string". I also learned about syntax and scope of variables from the calling procedure and permissions, and the possibility of SQL Injection, and a whole lot of other things.  Thank you for sharing this!

  • NP, normally I push harder to change the design or the aproach of the problem, but I don't think there's a way in this case.  But I hope you can find a way, or at least have arguments to go to your team leader and discuss this.

     

    Good luck with the rest of that project.

  • Hey Remi,

    Is there such a thing as a "Piviot Table View" and might it work in this case until she can normalize the tables?

  • I have never heard of it this way.  I think you'd be better off to start a new thread so you get more exposure for this question.  personnally I have no meaningfull experience with pivot tables so my opinion wouldn't be worth much more than my 2 cents .

Viewing 5 posts - 16 through 19 (of 19 total)

You must be logged in to reply to this topic. Login to reply