ADITYA PAWAR
ADITYA PAWAR

Reputation: 695

What is use of # in snowflake

It looks like # comment the rest of sentence but it throws error if we try to include it in execution command.(assumtion of commenting due to text turn out grey after # symbol) I know there is no official documentation that # is use for comment in snowflake. But we use // or -- for comment in snowflake. Anyone has idea what is use/meaning/equivalence of # symbol in snowflake.

P.S- I'm asking this because I am from SQL Server backround where # is use to create temporary table.

Example:

select * from aa// random comment;
; -- no issue at all

#select * from aa;
select * from aa //select * from aa;
;--SQL compilation error: syntax error line 1 at position 0 unexpected '#s'.

Upvotes: 0

Views: 463

Answers (1)

Marcel
Marcel

Reputation: 2622

As far as I know the "#"-symbol has no syntax-meaning in Snowflake.

Similar to SQL Server there are also Temporary tables in Snowflake: https://docs.snowflake.com/en/user-guide/tables-temp-transient.html

Temporary tables are somehow similar in SQL Server and Snowflake but it is important to know that temporary tables in Snowflake:

  1. only exist within the session in which they are created
  2. only exist for this certain session and are deleted automatically afterwards
  3. are not visible to other users or sessions
  4. don't have any fail-safe period, just 1 day time travel maximum

Upvotes: 2

Related Questions