Skip to content
Advertisement

Select columns based on condition in Snowflake

I am trying to find a solution to select columns in Snowflake based on a condition. For example I only want to select columns which contain the string “id” or only the numeric columns.

Is there any solution for these cases?

Best regards

Advertisement

Answer

You can use something as below. Following procedure query the account usage schema and generate a column list and then return a query based on table and column type. This can be extended

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement