Reputation: 315
I'm interested in getting the structure of each table in my DB.
Currently I'm using: DESCRIBE TABLE table1
.
However, this means I have to do a separate query for each table. Was wondering whether there is a query I can get the structure of several tables at once (and therefore saving me some queries)?
Thanks, Nir.
Upvotes: 0
Views: 56
Reputation: 2920
You have a couple options:
https://docs.snowflake.com/en/sql-reference/info-schema/columns.html
Note: The view only displays objects for which the current role for the session has been granted access privileges.
https://docs.snowflake.com/en/sql-reference/account-usage/columns.html
Note: this will show all the columns in all tables, will show deleted objects and such as well. Also note, there is a delay in the data (latency could be as much as 90 minutes, typically isn't though)
Upvotes: 0
Reputation: 281
You can use Account Usage/Information Schema view COLUMNS
https://docs.snowflake.com/en/sql-reference/account-usage/columns.html
Following article have a slight difference example of using COLUMNS view to create a select statement but it should give you an idea
Upvotes: 2