SQL Update

I would like to update a database via SQL. For this I have chosen the activity “Execute Non Query”.
Now I have tried the following command

“Update Test
set LAGRAD = '”+City+"’
where Code = ‘HET’ "

City is a variable I created of the type “String”. If I set a number like for example a 1 the update is done. But if I insert the variable this does not work.

Does this have something to do with the variable type or is the SQL command incorrect?
I hope you can help me.

Hi @luisablind96

Try writing the query in this way.

“Update Test"
“set LAGRAD = '”+City+”’"
"where Code = ‘HET’

Let me know what happens.

Hi @luisablind96 ,


"Update [Test] Set [LAGRAD]='"+City+"' Where Code = 'HET'"


Hi @Marius_Puscasu,
Thank you!!!
It works:)

Hi @Marius_Puscasu ,
do you know how it works when I want to update two variables?
“Update [Test] Set [LAGRAD]=’”+City+"’ and [BRGRAD]=’"+Value+"’ Where Code = ‘HET’"
It does not work with an “And” or my “,”.

Hi @luisablind96 ,

It should be something like this:

"Update [Test] Set [LAGRAD]='"+City+"', [BRGRAD]='"+Value+"' Where Code = 'HET'"

Please pay attention to the database columns. It should match the name and, the type should be compatible as well.

For a better understanding, you could also check this: https://www.w3schools.com/sql/sql_update.asp

Best regards,

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.