Almost all clients for DB2 return errors in format
Error: DB2 SQL Error: SQLCODE=-407, SQLSTATE=23502, SQLERRMC=TBSPACEID=2, TABLEID=103, COLNO=0, DRIVER=3.57.82
SQLState: 23502
ErrorCode: -407
Than I should google for SQLCODE, than for SQLState and then try to understand meaning of SQLERRMC. It is time consuming... I would like to know is there tool which parse such format and return human friendly formatted error, such as "You are tring to insert null in position 2 where only non null values posible..."
To convert 'SQLERRMC=TBSPACEID=x, TABLEID=y, COLNO=z' to schema, table and column names, at a SQL prompt:
SELECT C.TABSCHEMA, C.TABNAME, C.COLNAME
FROM SYSCAT.TABLES AS T,
SYSCAT.COLUMNS AS C
WHERE T.TBSPACEID = x
AND T.TABLEID = y
AND C.COLNO = z
AND C.TABSCHEMA = T.TABSCHEMA
AND C.TABNAME = T.TABNAME
Credit: I found this at http://www.dbforums.com/db2/1655517-how-find-table-tbspaceid-2-tableid-1583-a.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With