Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find the table containing the trigger

Status
Not open for further replies.

mimi2

Technical User
Apr 2, 2002
407
CA
Hello,
I would like to delete a record in a table but a get an error message:DELETE statement conflicted with COLUMN REFERENCE constraint 'FK_REF_36489_G'. The conflict occurred in database 'live', table 'audit', column 'id'.
The statement has been terminated.

how can i find the table that triggers an update in 'audit'?
the table containing my record does not insert in 'audit'

thanks
 
but - the error is not a trigger problem --- it looks more like a foriegn key problem (so there is a related record) when the cascading delete is not set. Get the properties of the table and check the relationship tab --- look at how the table you are deleting from is pointing to 'Audit' table and the id column. Sounds like they are keeping a key in the audit table that you might also have to get rid of.
 
Thanks
I tried to remove the key from from 'audit' but it does not solve anything. There is a foreign key declared.
Should it delete it too, and how ?

how do i use sysobjects ?

 
forget about sysobjects, Jymm is right. It's a Foreign Key problem and you can edit that in table properties
 
IF you really want to get rid of the record, you gotta delete the 'root' record (probably the audit record)... BUT I would be more concerned that the audit table record is tied to other places as well. Go into enterprise manager (hope you are on 2000) and look at the properties (easy way is to design the table, select the properties button) for the table in question AND the Audit table. See where the Foreign key is pointing. If it is pointing to more than one table things could be even more interesting.

think of FK as kindof a root of a tree and the other record as a branch. to get rid of the branch - you gotta get rid of the whole darn tree (in this case - no actual trees were harmed in this procedure). This sounds like a vendor product. I would bet that if you know the record in the Audit table that it is set up to 'cascade delete' (which is good and bad). If you want all references to the record to disappear that will do it.

this help?
 
thanks a lot. i could delete it from 'audit' then from my table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top