Skip to content
Advertisement

How to use variable in Select clause [closed]

I need way to call variable in select clause. Eg. Table name “TableList” contains the list of table names.

Error Message – Must declare the table variable “@name”.

I used “quotename()” as well but still getting the same error.

Advertisement

Answer

You would need to use dynamic SQL:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement