Unique_dc Constraint Issue in Reports Database

Sometimes, Ephesoft database scripts create a unique constraint (“Unique_dc”) with the wrong keys. This can result in the application failing with error messages as shown in the image below.

This was identified as a bug in Ephesoft v4.0.5.0 and fixed in the subsequent version.

Resolution

You can resolve this issue by running one of the following scripts on the Reports database to recreate the constraint properly.

Select the appropriate script to run based on your installation type.

For MYSQL

alter table document_correction drop index Unique_dc;

alter table document_correction  add constraint Unique_dcUNIQUE

(

batch_id,document_type

)

;

For MSSQL

alter table document_correction drop constraint Unique_dc

go

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERECONSTRAINT_TYPE=’UNIQUE’ AND TABLE_SCHEMA=’dbo’

AND TABLE_NAME = ‘document_correction’ AND CONSTRAINT_NAME =’Unique_dc’)

BEGIN

EXEC(‘alter table document_correction  add constraint [Unique_dc] UNIQUE NONCLUSTERED

(

[batch_id],[document_type]

)’)

END

go

Was this article helpful to you?

Ravi Shankar