Moa Passador
Moa Passador

Reputation: 23

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 this feature off?

Upvotes: 2

Views: 13943

Answers (2)

Gordon Linoff
Gordon Linoff

Reputation: 1270873

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.

Upvotes: 5

Rajashekar
Rajashekar

Reputation: 11

For your question:

SELECT """CategoryName""" FROM lk_category

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

Please check it using:

Describe View/Table Table/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.

Upvotes: 1

Related Questions