mysqlcfmllucee

MySQL Update Error - Cannot find what is wrong


I am working on a CFML project with a MySQL backend. I have a function that contains an SQL update statement. The cfquery looks like this:

<cfquery name="del" datasource="#APPLICATION.db.source#" username="#APPLICATION.db.user#" password="#APPLICATION.db.pass#">
    UPDATE changemgmt.rfc
    SET deleted_timestamp = <cfqueryparam cfsqltype="CF_SQL_TIMESTAMP" value="#Now()#">,
    SET deleted_by = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#SESSION.user.name#">
    WHERE rfc_id = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.rfc_id#">;
</cfquery>

This is the error that is being returned:

Lucee 5.3.7.48 Error (database)
Message 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 'SET deleted_by = 'first.last'
WHERE rfc_id = 3' at line 3
SQL UPDATE changemgmt.rfc
SET deleted_timestamp = modified_timestamp = {ts '2022-09-12 10:14:13'},
SET deleted_by = 'first.last'
WHERE rfc_id = 3;

Clearly, the error is telling me that I have an SQL syntax problem. If I remove the SET deleted_timestamp line, the function/query executes just as it should. I have spent a great deal of time on this and for the life of me cannot figure out why the error is being thrown. Can anyone tell me why what I have is not working?


Solution

  • I have discovered my error. I need to remove the second SET keyword from the SQL statement. Also, Dreamweaver was being quirky and not reflecting my edits. I closed Dreamweaver and reopened it and it was as if I hadn't made any edits when in fact I had.