A Beginner
A Beginner

Reputation: 389

Getting length of binary column in snowflake using information schema

As the title suggests, I want to determine the length that I have specified while creating the column of type BINARY in Snowflake. I tried to get this information from Information_Schema.COLUMNS view. But on inspecting the result I did not see any columns that had this information. I thought CHARACTER_OCTET_LENGTH of this view might contain this info but it does not.

I am aware that I can also use SHOW COLUMNS IN TABLE <tab_name> but for my requirement I only want to use the information_schema.

Is this information not stored in the information_schema?

Upvotes: 1

Views: 279

Answers (1)

Simeon Pilgrim
Simeon Pilgrim

Reputation: 25893

I know you don't want this solution, but I will just put it here for "other people" looking for the same thing.

create table test.test.test_len(bin_10 binary(10), bin_200 binary(200) );

show columns in table test.test.test_len;

select 
    "column_name" as name
    ,parse_json("data_type"):length::number as len
from table(RESULT_SCAN());
NAME LEN
BIN_10 10
BIN_200 200

Upvotes: 0

Related Questions