Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 638 Bytes

check-column-is-accessible.md

File metadata and controls

17 lines (13 loc) · 638 Bytes

Check if a column is accessible

Explore this snippet here.

Description

One method to check if the current session has access to a column is to use the COL_LENGTH function, which returns the length of a column in bytes. If the column doesn't exist (or cannot be accessed), COL_LENGTH returns null.

select
  col_length('Orders', 'Sales') as does_exist,
  col_length('Orders', 'Shmales') as does_not_exist
does_exist does_not_exist
8 NULL