Execute SQL - update existing records


Badge +11

I'm trying to update a SQL Table using the Execute SQL action where items have the same ID, without any luck. I used a previous INSERT INTO action sucessfully in a different workflow so my Connection string is good. I'm having issues with the Query.

My scenario is to have the SQL Table updated whenever the List item is modified based on the List Item ID which is a Primary key on the table.

UPDATE dbo.Table2
SET [Plant]=('{ItemProperty:Plant_x003a_}'),
[Employee]=('{ItemProperty:Employee_x003a_}'),
[Job Title]=('{ItemProperty:Job_x0020_Title_x003a_}'),
[Badge Number]=('{ItemProperty:Badge_x0020_number_x003a_}'),
[Course Name]=('{ItemProperty:CN}'),
[Date of Course]=('{ItemProperty:Date_x0020_of_x0020_course}'),
[Expiry date]=('{ItemProperty:Expiration_x0020_date}'),
[FacilityID]=('{ItemProperty:Facility_x003a_}'),
[CourseID]=('{ItemProperty:Course_x003a_}'),
[Employee Name]=('{ItemProperty:Employee_x0020_Name}'),
WHERE [ContentTypeID]=('{ItemProperty:ID}');

 

I do not get any errors, just items don't get updated in the table.


2 replies

Badge +3

I'm not sure if you ever resolved your issue but I use the update query and it looks like this:

 

UPDATE [DBO].[TABLEN_AME] SET WHERE COLUMN1='COLUMN1', COLUMN2='COLUMN2' WHERE ID='ID' 

 

Badge +11

wow , thank you! I never got it resolved on my end and Nintex support thought it was a database connection issue. I have tried your query and it works perfectly. : )

Reply