Nir99
Nir99

Reputation: 315

Snowflake create table syntax

I'm developing a program to parse sql queries I'm getting. I've encountered a syntax I'm not familiar with:

create table if not exists identifier(table1) ("ID" INTEGER)

I'm not familiar with the identifier usage and couldn't find any relevant documentation. Any ideas?

Upvotes: 1

Views: 3510

Answers (1)

Mike Walton
Mike Walton

Reputation: 7339

I can't tell whether you are trying to use an identifier() function to use a variable or not, but if you are, I think you're looking for something like this:

set table1 = 'my_table';

create table if not exists identifier($table1)(ID integer);

As an additional note, I wouldn't use double-quotes around your column names unless you are trying to escape a special character.

If you are not trying to use a variable in your table name, then just get rid of the identifier() function altogether.

Upvotes: 1

Related Questions