WordPress database error: [Disk full (/tmp/#sql-temptable-1-262161-2c1f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")]SHOW FULL COLUMNS FROM `markjacobsen_options`
I’m not a fan of NULL columns. So check out the query below if you want to find DB2 fields that are defined as nullable, but which contain no null values. You can also modify the query to show you how many records contain null values. Make sure to set the COLS.TABSCHEMA in the WHERE predicate. <\/p>\n
SELECT RTRIM(TAB.TABSCHEMA)||'.'||TAB.TABNAME AS TABLE_OBJECT_NAME \r\n, COLS.COLNAME AS COLNAME , COLS.TYPENAME AS \r\nTYPE ,RTRIM(CHAR(COLS.LENGTH))|| \r\nCASE COLS.SCALE \r\nWHEN 0 \r\nTHEN ' ' \r\nELSE ','||RTRIM(CHAR(COLS.SCALE)) \r\nEND || \r\nCASE COLS.TYPENAME \r\nWHEN 'VARCHAR' \r\nTHEN ' AVG:'||RTRIM(CHAR(COLS.AVGCOLLEN)) \r\nELSE ' ' \r\nEND AS LENGTH \r\n,TAB.CARD as TAB_CARD \r\n,COLS.COLCARD AS COL_CARD \r\n,CASE \r\nWHEN NULLS ='Y' \r\nTHEN 'NULL ('||RTRIM(CHAR(NUMNULLS))||')' \r\nWHEN NULLS = 'N' THEN 'NOT NULL' \r\nELSE '??' END as NUM_NULLS \r\n,RTRIM(COLS.TABSCHEMA)||'.'||COLS.TABNAME||'2' AS SORTCOL,COLS.COLNO AS SORTCOL2 \r\nFROM SYSCAT.COLUMNS COLS \r\nINNER JOIN SYSCAT.TABLES TAB ON (COLS.TABSCHEMA = TAB.TABSCHEMA AND COLS.TABNAME = TAB.TABNAME) \r\nWHERE RTRIM(COLS.TABSCHEMA) = 'XX' \r\nAND ( \r\n(NULLS = 'Y' AND NUMNULLS=0 AND TAB.CARD > 0) \r\n--OR (COLS.TYPENAME = 'VARCHAR' AND COLS.AVGCOLLEN >= COLS.LENGTH-2) \r\n) \r\nORDER BY SORTCOL,SORTCOL2 \r\nFOR READ ONLY WITH UR;<\/code><\/pre>\nPlease remember to subscribe to the newsletter<\/a> to stay up to date!<\/i>
\n
\nYou or someone you know looking to buy or sell?<\/i>\n<\/a>
\nDisclaimer: Thoughts and opinions are my own, and do not reflect the views of any employer, family member, friend, or anyone else. Some links may be affiliate links, but I don't link to anything I don't use myself. You would think this should be self evident these days, but apparently not...<\/small><\/i>","protected":false},"excerpt":{"rendered":"I’m not a fan of NULL columns. So check out the query below if you want to find DB2 fields that are defined as nullable, but which contain no null values. You can also modify the query to show you how many records contain null values. Make sure to set the COLS.TABSCHEMA in the WHERE … Continue reading Find Nullable Columns in DB2 with no Null Values<\/span>