Skip to content Skip to sidebar Skip to footer

Snowflake: Select "column" With Double Quotes

I have a customer that their Snowflake instance require the columns name to have double quotes. Example: SELECT 'CategoryName' from 'lk_category' ; Does anyone know how to turn th

Solution 1:

The Snowflake documentation does explain a bit about identifiers.

The key point is that quoted identifiers must be referred to exactly as they are defined. So, the following are different:

"ABC""abc""Abc"

Unquoted identifiers are case-insensitive, so the following are the same:

ABC
abc
Abc

As a bonus, these are also equivalent to:

"ABC"

because Snowflake resolves unquoted identifiers using the upper case.

If the database has already been created with quoted identifiers . . . well, you can go about changing it.

Snowflake has identified this as a problem. You can turn off the quoted behavior by setting the QUOTED_IDENTIFIERS_IGNORE_CASE parameter.

Solution 2:

For your question:

SELECT """CategoryName""" FROM lk_category

…is the answer. I had a similar issue with double pivot tables.

Please check it using:

DescribeView/TableTable/View_Name

We will get the list of Column Names, If a field name with double quote Ex:"Name" is present.

Then to select it we should use extra quotes as escape characters.

Post a Comment for "Snowflake: Select "column" With Double Quotes"