MVP Systems Software  
email us now

Editing a Setup definition fails with primary key violation

Expand / Collapse
 

Editing a Setup definition fails with primary key violation


Editing a Setup definition may fail with an exception like:

Setup update failed

Job update failed

Violation of PRIMARY KEY constraint 'PK_SetupD'. Cannot insert duplicate key in object 'dbo.SetupD'.

The statement has been terminated.

If this happens every time you edit a particilar Setup, the Setup definition that is saved in the database is corrupt.  To repair this corruption, follow these steps:

1. Right click on the problem Setup and pick "Copy To".
2. Enter a new name to copy the problem Setup to a new name.
3. Delete the problem Setup.
4. Rename the new copy of the Setup back to the original name.

Copying the Setup to a new name may not be a good solution if you have other objects that reference the Setup.   In that case, you need to use SQL to correct the issue.  To correct this issue with SQL, execute this command on the SQL Server machine:

SQLCMD -E -d JAMS -Q "delete from dbo.SetupD where job_id = 0"

CAUTION: This command deletes data from the JAMS Database.  Make sure that you have a recent backup of the JAMS database before executing this command.  Make sure that you type the command exactly as shown or you run the risk of deleting important data.



Rate this Article:
Tags:

Add Your Comments


Name: *
Email Address:
Web Address:
   
  
 
 
   
Verification Code:
*
 

Details
Last Modified:Wednesday, April 06, 2011

Last Modified By: JohnV

Type: FIX

Rated 5 stars based on 1 vote

Article has been viewed 1,343 times.

Options