Thursday, May 15, 2008

Assignment of a NULL value to a NOT NULL column

error message:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/LINUX] SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=31, TABLEID=69, COLNO=3" is not allowed. SQLSTATE=23502

solution:
SELECT tabschema, tabname, colnameFROM syscat.columnsWHERE colno = 3 AND( tabschema, tabname ) IN( SELECT tabschema, tabnameFROM syscat.tablesWHERE tbspaceid =31 ANDtableid = 69 )

Thursday, May 8, 2008

db2 commands

  • get db configuration
db2 get db cfg for databasename
db2 update db cfg for dbname using screenname value
db2 get dbm cfg
  • to list all tables, filtering out views
db2 list tables show detail | grep -v ' V ' | awk '{print $1}'