Raj Gajula
Raj Gajula

Reputation: 36

SQL compilation error: syntax error line 1 at position 7 unexpected 'ROWS'

When I run the below query from snowflake web UI, Here is the error message:

select ROWS from "SNOWFLAKE"."ACCOUNT_USAGE"."METERING_HISTORY";

SQL compilation error: syntax error line 1 at position 7 unexpected 'ROWS'

When I do a

select * on the view, I am able to see the column 'ROWS'.

Upvotes: 0

Views: 2476

Answers (2)

sprethepa
sprethepa

Reputation: 757

You have used ROWS which is a reserved keyword. You can use it when enclosed within quotes.

select "ROWS" from "SNOWFLAKE"."ACCOUNT_USAGE"."METERING_HISTORY";

You can refer to the below documentation for the reserved keywords list. https://docs.snowflake.com/en/sql-reference/reserved-keywords.html#reserved-limited-keywords

Upvotes: 0

Himanshu Kandpal
Himanshu Kandpal

Reputation: 1608

put the column name rows in quote, as it is a reserved name (ANSI reserved) , any reason why the column is called ROWS ?

select "ROWS" from tst1;

Upvotes: 1

Related Questions