IBM DB2 Query Toolbox - Check if is column nullable in Db2 database



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

IBM Db2 Query Toolbox - Check if is column nullable in Db2 database

A consulta abaixo verifica o atributo de nulidade da coluna.
Query below check nullability attribute for the column.

Consulta - Query

SELECT TABSCHEMA AS SCHEMA_NAME
,      TABNAME AS TABLE_NAME
,      COLNAME AS COLUMN_NAME
,      CASE NULLS 
            WHEN 'N' THEN 'NOT NULLABLE'
            WHEN 'Y' THEN 'IS NULLABLE'
       END AS NULLABLE 
  FROM SYSCAT.COLUMNS 
 WHERE TABSCHEMA NOT LIKE 'SYS%' 
 ORDER BY TABSCHEMA
 ,        TABNAME,COLNAME;

Colunas

  • schema_name - nome do esquema
  • table_name - nome da mesa
  • column_name - nome da coluna
  • nullable - atributo nullability para a coluna:
    • is nullable - é anulável
    • not nullable - não é anulável

Linhas

  • Uma linha representa uma coluna no banco de dados
  • Escopo das linhas: todas as colunas do banco de dados
  • Ordenado por nome do esquema, nome da tabela, nome da coluna

Columns

  • schema_name - name of schema
  • table_name - name of table
  • column_name - column name
  • nullable - nullability attribute for the column:
    • is nullable - is nullable
    • not nullable - is not nullable

Rows

  • One row represents one column in the database
  • Scope of rows: all columns in the database
  • Ordered by schema name, table name, column name

Resultado - Sample results


Copyright © Dataedo.