SQL Deadlocks - Database Query component

Keep getting SQL deadlocks in the Workflow on all customers running a lot of SQL querys. This problem has been there for years.

ERROR: 11:42:41.521 [0026] W3612 : Error running SQL: [Microsoft][ODBC SQL Server Driver][SQL Server]Transaction (Process ID 93) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction

An as the SQL experts say, this is not a SQL problem but bad programming in PP Workflow // Database Query component.

Ia there anoother way to read/write to a SQL DB, without using the Database Query component, like in a java script ?

A simple query could be like this:
Update dbo.docs
set PrintDate=getdate()
where Envelopeid = ‘%{envelopeId}’

IF @@ROWCOUNT= 0
INSERT INTO dbo.Docs
(EnvelopeId, PrintDate)

VALUES
(‘%{EnvelopeID}’,
‘%{PrintDate}’
)

I have solved by now by putting in extra checks to see if the SQL read/write was done correct. But it gives a lot of extra workflow components, and sometime 1 check is not enoug - and you have to put in a delay in ms. This is an exampel of all the extra components for the extra check.



Search for ADODB in the forums, you will find plenty of examples of connecting to a database using a script in Workflow.