Query below returns a list of all columns in a specific table in Snowflake database.

Query

SELECT	ordinal_position as "Position",
       	column_name as "Column Name",
       	data_type as "Data Type",
       	CASE WHEN character_maximum_length IS NOT NULL
        	THEN character_maximum_length
            ELSE numeric_precision
		END as "Max Length",
       	is_nullable as "Is Nullable",
       	column_default as "Default Value"
FROM information_schema.columns
WHERE table_schema ILIKE 'schema'	-- put your schema name here.
       and table_name ILIKE 'table'	-- put your table name here.
ORDER BY ordinal_position;

Sample Results

Source

List all columns in specific table in Snowflake - Snowflake Data Dictionary Queries (dataedo.com)

  • No labels