Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Snowflake: How to filter on a "field name" that contains spaces? It works fine in select statement but not in whereclause filter

This code works fine:

SELECT distinct "Line Status" from TEMP_TS_SUBSCR_ACCT_CUST_INFO;

but this code returns error:

SELECT * from TEMP_TS_SUBSCR_ACCT_CUST_INFO where "Line Status" = "Active";

SQL compilation error: error line 1 at position 66 invalid identifier ‘"Active"’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Please advise what could be wrong.

>Solution :

String literals should be enclosed with ' or $$:

SELECT * 
FROM TEMP_TS_SUBSCR_ACCT_CUST_INFO 
WHERE "Line Status" = 'Active'; 
-- WHERE "Line Status" = $$Active$$;

Double quotes are required for identifiers that contain spaces (here column name).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading