|
A consulta abaixo lista as restrições de verificação definidas no banco de dados ordenadas pelo nome da restrição.
Query below lists check constraints defined in the database ordered by constraint name.
Consulta - Query
SELECT CON.CONSTNAME AS CONSTRAINT_NAME
, CON.TABSCHEMA CONCAT '.' CONCAT CON.TABNAME AS TABLE
, COL.COLNAME AS COLUMN_NAME
, CON.TEXT AS DEFINITION
, CASE TAB.ENFORCED
WHEN 'N' THEN 'DISABLED'
WHEN 'Y' THEN 'ACTIVE'
END AS STATUS
FROM SYSCAT.CHECKS CON
JOIN SYSCAT.COLCHECKS COL ON COL.CONSTNAME = CON.CONSTNAME
AND COL.TABSCHEMA = CON.TABSCHEMA
AND COL.TABNAME = CON.TABNAME
JOIN SYSCAT.TABCONST TAB ON TAB.CONSTNAME = CON.CONSTNAME
AND TAB.TABSCHEMA = CON.TABSCHEMA
AND TAB.TABNAME = CON.TABNAME
WHERE CON.TABSCHEMA NOT LIKE 'SYS%'
ORDER BY CON.CONSTNAME
|
Colunas
- constraint_name - nome da restrição no banco de dados
- tabela - a restrição do esquema e do nome da tabela é definida para
- column_name - nome da coluna
- definição - expressão SQL que define esta restrição de verificação
- status - status de restrição
- 'ativo' se a restrição estiver ativa,
- 'desativado' para restrições desativadas
Linhas
- Uma linha representa uma restrição de verificação ou coluna de restrição.
Se a restrição de verificação consistir em várias colunas (restrições de verificação em nível de tabela), cada coluna aparecerá separadamente
- Escopo das linhas: a consulta retorna todas as restrições de verificação no banco de dados
- Ordenado pelo nome da restrição
|
Columns
- constraint_name - name of the constraint in the database
- table - schema and table name constraint is defined for
- column_name - name of the column
- definition - SQL expression that defines this check constraint
- status - constraint status
- 'active' if constraint is active,
- 'disabled' for disabled constraints
Rows
- One row represents one check constraint or constraint column.
If check constraint consists of multiple columns (table-level check constraints), each column appears separately
- Scope of rows: query returns all check constraints in the database
- Ordered by constraint name
|
Resultado - Sample results

Copyright © Dataedo.
|