Deciphering DB2 error messages
DB2 SQL errors are so typical of errors in IBM products - enigmatic and unhelpful. I recently found out that there's an SQL query you can run to determine which table and column an error (like the one below) is referring to:
... Assignment of a NULL value to a NOT NULL column "TBSPACEID=3, TABLEID=14, COLNO=1" is not allowed. ...
This magical SQL is:
SELECT tabschema, tabname, colname FROM syscat.columns
WHERE colno = 1 AND ( tabschema, tabname ) IN
( SELECT tabschema, tabname FROM syscat.tables WHERE tbspaceid = 3 AND tableid = 14 )
Just sub in the tablespace, table and column IDs from your error message, and you're away.
Comments
Leave a comment
Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>
Comment by Robert Mark Bram [Visitor] · http://robertmarkbramprogrammer.blogspot.com/ — 07/09/07 @ 04:55
Comment by Björn [Visitor] · http://blog.blinker.net — 06/26/08 @ 07:05