So I've been fighting this for days. I dont have the slightest idea where I can go from here. I have your standard coldfusion insert queries set up to insert new data into the database. Something along the lines of:
Select * from table where tableuniqueID = Form.UniqueID
Cfif databasecheck.recordcount EQ 0, then insert new row with form.uniqueID as the uniqueID. Well recently, its been throwing the generic Violation of PRIMARY KEY constraint 'PK__OLMS_Dat__9C04DA075F0A3F61'. Cannot insert duplicate key in object 'dbo.table'.
I dont understand that in the slightest, the only way it inserts is if the query right above it is defined and equal to 0 recordcount.
I did some tooling around, and found someone suggesting to insert into my SQL "IF NOT EXISTS" to have SQL do the actual check to see if data exists. Well we put that in place, and just recently, ANOTHER duplicate happened, same error, cannot insert duplicate showing the new SQL structure.
This is beyond me. I have two statements checking to see if it exists and, yet, Coldfusion still tries to execute a database insert. What is going on?? Any ideas? You would figure this would be the basics.