Check if is column nullable in Azure SQL database

Bart Gawrych - Dataedo Team Bart Gawrych 2019-04-01

Table of Contents:


    Query below check nullability attribute for the column.

    Query

    select schema_name(t.schema_id) as schema_name,
           t.name as table_name,
           c.name as column_name,
           case is_nullable
                when 0 then 'NOT NULLABLE'
                else 'NULLABLE'
                end as nullable
    from sys.columns c
    join sys.tables t
         on t.object_id = c.object_id
    order by schema_name,
             table_name,
             column_name;
    

    Columns

    • schema_name - schema name
    • table_name - table name
    • column_name - column name
    • nullable - nullability attribute for the column:
      • 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

    Sample results

    0
    There are no comments. Click here to write the first comment.

    By continuing to use our website, you consent to the use of cookies in accordance with our Privacy Policy.
    Accept