We are trying to run some SQL query via the PRESTEP and POSTSTEP option present in TDM Portal.
As per available documentation, we need to give path to file where there would be SQL commands.
We did created a file with ALTER commands to disable the primary key constraints, the files were created with extension as ".SQL" and ".TXT"
When we ran the JOB to do actual masking, job failed with error as unable to mask column due to primary key constraint which means the PRESTEP file did not execute.
Below is one sample command we gave in the file and attached is the masking setting and file for reference.
ALTER TABLE dbo.<Table_name> DROP CONSTRAINT <Primary_key_containt>;
TDM portal 4.11
SQL Server as database.
From masking execution logs, we noticed below error. Database is returning an error code 3728. It means, primary key constraint is already removed on the table and constraint does not exist.
2025-09-26 12:11:21.150 main - Error processing sql ALTER TABLE dbo.<Table_name> DROP CONSTRAINT <Primary_key_constraint>
2025-09-26 12:11:21.151 main - Error Code:3728
So, change the ALTER query like below. This will delete the constraint if exists.
ALTER TABLE dbo.<Table_name> DROP CONSTRAINT IF EXISTS <Primary_key_constraint>;