FK-constraint violation
Posted in 1999
Topics: General Discussion
My problem is that I have a mastertable that has several childtables and if I delete a row in my mastertable I can parse sqlca.sqlerrd[1] to find out that someone is referencing my mastertable (-692. Key value for constraint (my mastertables PK-constraintname) is still being referenced) but I want to know the name of the FK-constraint that was violated Is there any way to find out the name of the constraint that was violated. Thanks /Mickael Lindh -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
I have a script that will show the tables that are referenced by a table. It has some SQL that shows the informix tables that track constraints. URL: http://www.tc.umn.edu/~hause011 script is ref_load_ord -- --------------------------------------------------------- Steven Hauser email: hause011@tc.umn.edu URL: http://www.tc.umn.edu/~hause011 ---------------------------------------------------------
Mickael, After the constraint has been violated you can evaluate the SQLERRM member of the SQLCA record. The SQLERRM member contains the name of the constraint that has been voilated. With the constraint name you can query the 'sysconstaints' catalog table and find out what you want to know. Regards, Henk mickelindh@my-dejanews.com wrote: > My problem is that I have a mastertable that has several childtables and if I > delete a row in my mastertable I can parse sqlca.sqlerrd[1] to find out that > someone is referencing my mastertable (-692. Key value for constraint (my > mastertables PK-constraintname) is still being referenced) but I want to know > the name of the FK-constraint that was violated > > Is there any way to find out the name of the constraint that was violated. > > Thanks > > /Mickael Lindh > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Mickael, After the constraint has been violated you can evaluate the SQLERRM member of the SQLCA record. The SQLERRM member contains the name of the constraint that has been voilated. With the constraint name you can query the 'sysconstaints' catalog table and find out what you want to know. Regards, Henk mickelindh@my-dejanews.com wrote: > My problem is that I have a mastertable that has several childtables and if I > delete a row in my mastertable I can parse sqlca.sqlerrd[1] to find out that > someone is referencing my mastertable (-692. Key value for constraint (my > mastertables PK-constraintname) is still being referenced) but I want to know > the name of the FK-constraint that was violated > > Is there any way to find out the name of the constraint that was violated. > > Thanks > > /Mickael Lindh > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own