Violation of PRIMARY KEY constraint troubleshooting

  • Marcel,
    I got a call from the technologist saying that a study had an error going to the Conquest server. I looked in the logs and found the following:


    Code
    [size=10]20080530 11:38:11 ***[AddImageFile] Error entering object into server: D:\1.2.392.200036.9123.100.12.11.21087.200805305091415\1.2.392.200036.9123.100.12.11.21087.20080530093833.3\1.2.392.200036.9123.100.12.11.21087.20080530093833.3.7.dcm
    20080530 11:38:11 ***Failed SQLExecDirect : INSERT INTO DICOMImages (SOPInstanc, SOPClassUI, ImageNumbe, ImageDate, ImageTime, EchoNumber, AcqDate, AcqTime, ReceivingC, AcqNumber, SliceLocat, SamplesPer, PhotoMetri, Rows, Colums, BitsStored, ImageType, ImagePat, SeriesInst, AccessTime, ObjectFile, DeviceName) VALUES ('1.2.392.200036.9123.100.12.11.21087.20080530093833.3.8', '1.2.840.10008.5.1.4.1.1.4', '8', '20080530', '093544.270', '1\5', '20080530', '093544.270', 'MA Head', '1', '15.5', '1', 'MONOCHROME2', '256', '256', '16', 'ORIGINAL\PRIMARY\OTHER', '11452', '1.2.392.200036.9123.100.12.11.21087.20080530093833.3', 1212172672, '1.2.392.200036.9123.100.12.11.21087.200805305091415\1.2.392.200036.9123.100.12.11.21087.20080530093833.3\1.2.392.200036.9123.100.12.11.21087.20080530093833.3.8.dcm', 'MAG0')
    20080530 11:38:11 ***Error: 2627: 23000: [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK__DICOMImages__24927208'. Cannot insert duplicate key in object 'dbo.DICOMImages'.
    20080530 11:38:11 ***Unable to DB.Add()
    20080530 11:38:11 ***SQL: INSERT INTO DICOMImages (SOPInstanc, SOPClassUI, ImageNumbe, ImageDate, ImageTime, EchoNumber, AcqDate, AcqTime, ReceivingC, AcqNumber, SliceLocat, SamplesPer, PhotoMetri, Rows, Colums, BitsStored, ImageType, ImagePat, SeriesInst, AccessTime, ObjectFile, DeviceName) VALUES ('1.2.392.200036.9123.100.12.11.21087.20080530093833.3.8', '1.2.840.10008.5.1.4.1.1.4', '8', '20080530', '093544.270', '1\5', '20080530', '093544.270', 'MA Head', '1', '15.5', '1', 'MONOCHROME2', '256', '256', '16', 'ORIGINAL\PRIMARY\OTHER', '11452', '1.2.392.200036.9123.100.12.11.21087.20080530093833.3', 1212172672, '1.2.392.200036.9123.100.12.11.21087.200805305091415\1.2.392.200036.9123.100.12.11.21087.20080530093833.3\1.2.392.200036.9123.100.12.11.21087.20080530093833.3.8.dcm', 'MAG0')
    20080530 11:38:11 ***Error: 2627: 23000: [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK__DICOMImages__24927208'. Cannot insert duplicate key in object 'dbo.DICOMImages'.
    20080530 11:38:11 ***Error saving to SQL: 1.2.392.200036.9123.100.12.11.21087.200805305091415\1.2.392.200036.9123.100.12.11.21087.20080530093833.3\1.2.392.200036.9123.100.12.11.21087.20080530093833.3.8.dcm[/size]


    Here's what I have figured out so far, could you please tell me if I am on the right track? The patient already existed in the database with a Patient ID of 11542. The tech was sending the same patient with a Patient ID of 11452. Is that the Primary key violation? If so, then why does it say in the Conquest manual that "The PatientName, PatientBirthDate and PatientSex items are duplicated in the study table (database rev8 and up), to allow detection of patient ID mix-ups." It sounds like it should have accepted the fat fingered Patient ID, doesn't it - or is the Patient ID the holy grail, and must be consistent? Could you steer me in the right direction? Thanks! -Scott

  • Marcel,
    What is the best way to determine what is violating the PRIMARY KEY constraint? I am banging my head on this. We don't have a worklist running yet, so I am at the mercy of the technologist. Here is part of the verbose log of the problem patient. Where can I look to determine the problem? We're running SQL2005 as the database. I've checked the usual suspects (name, patid, birthdate, sex), but all seem consistent with previous studies of the same patient already in Conquest. Please help. -Scott


    Code
    20080611 12:55:49 ***Failed SQLExecDirect : INSERT INTO DICOMImages (SOPInstanc, SOPClassUI, ImageNumbe, ImageDate, ImageTime, EchoNumber, AcqDate, AcqTime, ReceivingC, AcqNumber, SliceLocat, SamplesPer, PhotoMetri, Rows, Colums, BitsStored, ImageType, ImagePat, SeriesInst, AccessTime, ObjectFile, DeviceName) VALUES ('1.2.392.200036.9123.100.12.11.21087.20080530192735.6.44', '1.2.840.10008.5.1.4.1.1.4', '44', '20080530', '192352.560', '2\11', '20080530', '192352.560', 'MA Flex Body(L)', '1', '-51.2', '1', 'MONOCHROME2', '256', '256', '16', 'ORIGINAL\PRIMARY\OTHER', '9511', '1.2.392.200036.9123.100.12.11.21087.20080530192735.6', 1213214144, '1.2.392.200036.9123.100.12.11.21087.2008053020185150\1.2.392.200036.9123.100.12.11.21087.20080530192735.6\1.2.392.200036.9123.100.12.11.21087.20080530192735.6.44.dcm', 'MAG0')
    20080611 12:55:49 ***Error: 2627: 23000: [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK__DICOMImages__24927208'. Cannot insert duplicate key in object 'dbo.DICOMImages'.
    20080611 12:55:49 ***Unable to DB.Add()
    20080611 12:55:49 ***SQL: INSERT INTO DICOMImages (SOPInstanc, SOPClassUI, ImageNumbe, ImageDate, ImageTime, EchoNumber, AcqDate, AcqTime, ReceivingC, AcqNumber, SliceLocat, SamplesPer, PhotoMetri, Rows, Colums, BitsStored, ImageType, ImagePat, SeriesInst, AccessTime, ObjectFile, DeviceName) VALUES ('1.2.392.200036.9123.100.12.11.21087.20080530192735.6.44', '1.2.840.10008.5.1.4.1.1.4', '44', '20080530', '192352.560', '2\11', '20080530', '192352.560', 'MA Flex Body(L)', '1', '-51.2', '1', 'MONOCHROME2', '256', '256', '16', 'ORIGINAL\PRIMARY\OTHER', '9511', '1.2.392.200036.9123.100.12.11.21087.20080530192735.6', 1213214144, '1.2.392.200036.9123.100.12.11.21087.2008053020185150\1.2.392.200036.9123.100.12.11.21087.20080530192735.6\1.2.392.200036.9123.100.12.11.21087.20080530192735.6.44.dcm', 'MAG0')
    20080611 12:55:49 ***Error: 2627: 23000: [Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PK__DICOMImages__24927208'. Cannot insert duplicate key in object 'dbo.DICOMImages'.
    20080611 12:55:49 ***Error saving to SQL: 1.2.392.200036.9123.100.12.11.21087.2008053020185150\1.2.392.200036.9123.100.12.11.21087.20080530192735.6\1.2.392.200036.9123.100.12.11.21087.20080530192735.6.44.dcm
  • Hi,


    You can use view/edit database, use query on UID (double click one of the lower labels in from of the edit boxes on the query move page). You can copy the UID from the llog entry you showed.


    Marcel

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!