Insert, Update, Delete SQL command passing table name as parameter - unable to find declaration of parameter- Bug or a coding problem?

Hi,

I am trying to run a SQL delete command simple like “Delete from @tablename” within Execute Non Query. I have declared the parameter @tablename already, but while executing it is showing an error : Must declare the table variable "@tablename ". The same problem is happening for Insert & update operations also. During runtime @parameter is supposed to be replaced with declared value, but error message is showing parameter is not declared. Similar way I did for select query with parameter passing which is working fine. I tried with other query like “DBCC CHECKIDENT ( @tablename, RESEED, 0 )”. This one working file same parameter declaration. I am not sure if I am doing anything wrong in the syntax or is it a bug of Ui Path. Can anyone please help me with require Insert/ Update & Delete query. What is the correct syntax of Delete query? Thanks in Advance.

1 Like

I have the same issue and get the same error when trying to pass the database name or table name as a parameter. Using them in the query with the prefix @ just doesn’t work. They seem to only work after where clause (like “…where id=@value”)

Of course I could define the query string in a separate string variable and pass it on to Execute query, but it would be better practice just to pass the parameter straight to the query.

I searched the forum, but I couldn’t find an answer to this.

Anybody?

1 Like

@Paramita.Pradhan @NikoRJ Hi guys, did you find the answer for this?