MySQL Update syntax
Posted: Fri May 31, 2013 3:58 pm
Hi,
I struggle with the MySQL update syntax for the whole day but still couldn't find a solution. I hope some expert could help me with the UPDATE syntax.
put "personal_info" into tTableName
put "user_addr1", "user_addr2" into tFields
put field "fld_piUserID" into tuser_id
put field "fld_addr1" into taddr1
put field "fld_addr2" into taddr2
put "UPDATE " & tTableName & " SET (" & tFields & ") = VALUES(:1,:2) WHERE " & user_id &" =" & tuser_id & " "into tSQL
revExecuteSQL gConnectionID, tSQL, "taddr1", "taddr2"
I encounter the following error message. The contents in the error message are correct but it just did not update the table.
"There was a problem adding the records into the database:
You have an error in your SQL syntax, check the manual that corresponds to your MySQL server version for the right syntax to use
near '(user_addr1, useraddr2) = VALUES("10 Ceylon Road", "") WHERE user_id = 10008" at line 1"
By the way, user_id is set as an integer in the table.
Thanks for your help.
I struggle with the MySQL update syntax for the whole day but still couldn't find a solution. I hope some expert could help me with the UPDATE syntax.
put "personal_info" into tTableName
put "user_addr1", "user_addr2" into tFields
put field "fld_piUserID" into tuser_id
put field "fld_addr1" into taddr1
put field "fld_addr2" into taddr2
put "UPDATE " & tTableName & " SET (" & tFields & ") = VALUES(:1,:2) WHERE " & user_id &" =" & tuser_id & " "into tSQL
revExecuteSQL gConnectionID, tSQL, "taddr1", "taddr2"
I encounter the following error message. The contents in the error message are correct but it just did not update the table.
"There was a problem adding the records into the database:
You have an error in your SQL syntax, check the manual that corresponds to your MySQL server version for the right syntax to use
near '(user_addr1, useraddr2) = VALUES("10 Ceylon Road", "") WHERE user_id = 10008" at line 1"
By the way, user_id is set as an integer in the table.
Thanks for your help.