Pavan Chowdary
Pavan Chowdary

Reputation: 11

Creation of table in snowflake with current month & year like 202108

I've to create a table in snowflake from snowsql with the current date like "test_202108" where 2021 is year & 08 is month.

I'm automating the process using shell script. Like creation of table, put & copy commands.

Can anyone please help me on that.

Thanks Pavan Kumar

Upvotes: 0

Views: 64

Answers (1)

Srinath Menon
Srinath Menon

Reputation: 1642

You can test the following : Set a variable which is concatenation of year and month:

set value= (select 'table'||year(current_date()))||(select month(current_date()));

and with this use identifier keyword to reference the variable in the following :

CREATE table identifier($value) (col integer);

Upvotes: 1

Related Questions