Select constant along with * in Snowflake?

Viewed 235

I have a table in snowflake, say like:

MyTable

A   |  B 
---------
12. |. 12 
13. |. 13

I want to do something like SELECT "myconstant" as newcolumn, MyTable.* from MyTable" so the result is like:

newcolumn | A   |  B 
--------------------
myconstant| 12. |. 12 
myconstant| 13. |. 13

But I get the error saying

SQL compilation error: error line 1 at position 7 invalid identifier 'myconstant'

Is it possible to do something like this?

1 Answers

String constants aka literals are wrapped with ' or $$:

SELECT 'myconstant' as newcolumn, MyTable.* from MyTable;

SELECT $$myconstant$$ as newcolumn, MyTable.* from MyTable;
Related