Skip to content
Advertisement

How to pass table name and column name dynamic in SQL

I was trying to pass table name and column name dynamic, this is as part of SSIS process I am trying this stored procedure below.

On executing this, I am NOT getting count as result, instead I am getting execution success.

I need to get the count as output.

Also my simple direct query is like this

Advertisement

Answer

I think you may need to modify you value passing and your concatenation values.

from this statement you need to remove the semi colon as it will throw error

While passing blank values you need additional quotes

While execution I believe you wanted to execute final instead of SQL

I think below should give your output:

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