Pass Table name as a parameter in Execute Query Activity

Hi,

I am trying to Execute a SQL query, in that I want to pass table name as a parameter.
is it possible to pass table name in the query?
here is my query.
select * from dbo.tableName_201807 Where Respond in ('Ok','Reconciliation','Manual Confirm')

2 Likes

Hello @anshul_nema did you ever get to do this?

Hi,

We can achieve the above requirement by passing variable dynamically ( mostly we can assign the table name in the config sheet we can retrieve) in the expression. Please refer below. Thanks.

"select * from "+Config(“DBTableName”). tostring+ “Where Respond in (‘Ok’,‘Reconciliation’,‘Manual Confirm’)”

1 Like

Hey @kirankumar.mahanthi1 , thank you very much.
I am trying this but i am receiving the error: string constants must end with a double quote
“Select Distinct [SenderName]
FROM “+ config(“invoiceSender”).ToString +”
Where [InvoiceNumber] = @fileName

I will keep trying, thank you very much!

Luis

Hi,

Could you pls try like below. thanks.

"Select Distinct [SenderName] From "+config(“invoiceSender”).ToString+“Where [InvoiceNumber] = @fileName

Please try to keep the above statement in single line. some times splitting the expression into multiple lines will trigger exception. thanks

Hi @kirankumar.mahanthi1 thank you very much for your help and suggestions, however, is not working…

Hey @kirankumar.mahanthi1 and @anshul_nema

i got it working from the Execute Query activity like this:

“Select Distinct [SenderName] FROM “””+ config(“invoiceSender”).ToString +“”“Where [InvoiceNumber] = @fileName

Thank you!!

1 Like