Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Mickael Lindh, deleting from a master table with several child tables, got error -692 (key value still referenced) but wanted the name of the violated FK constraint. Steven Hauser offered a script querying the constraint catalog tables. Henk van der Geld advised reading the SQLERRM member of SQLCA, which holds the constraint name, then looking it up in sysconstraints. No confirmation from the poster.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
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
↪ replying to mickelindh@my-dejanews.com
Steven Hauser — — source: Informix-list mailing list archive (1991-1998)
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
---------------------------------------------------------
↪ replying to mickelindh@my-dejanews.com
Henk van der Geld — — source: Informix-list mailing list archive (1991-1998)
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
↪ replying to mickelindh@my-dejanews.com
Henk van der Geld — — source: Informix-list mailing list archive (1991-1998)
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
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.