List table default values in Snowflake

Query below lists table default constraints.

Query

select table_schema, 
       table_name,
       column_name,
       column_default
from information_schema.columns 
where column_default is not null
order by table_schema,
       table_name, column_name

Columns

  • table_schema - name of the schema
  • table_name - name of the table
  • column_name - name of the column
  • column_default - value or SQL expression that defines this default constraint

Rows

  • One row represents one column
  • Scope of rows: query returns all columns with default values
  • Ordered by table schema, table name, column name

Sample results

Comments are only visible when the visitor has consented to statistics cookies. To see and add comments please accept statistics cookies.
0
There are no comments. Click here to write the first comment.