I've recently delved into the world of Snowflake and hit a roadblock with this issue:
My goal is to duplicate a table named AB_USER to AB_USER_(current_date). Here's the code I've come up with in an attempt to achieve that:
CREATE or replace PROCEDURE backup_proc()
RETURNS VARCHAR
LANGUAGE javascript
AS
$$
var tab_name = `AB_USER_BCK_2020_`+ current_date();
stat = `create or replace table staging.` + tab_name + ` clone staging.AB_USER`;
var rs = snowflake.execute( { sqlText: stat} );
return 'Done.';
$$;
The issue lies in my inability to locate the right function for obtaining the current date. While Snowflake offers a JS environment, I'm unsure which function should be used to retrieve the current date.
I'm still quite new to using Snowflake, so any guidance on this matter would be greatly appreciated.
Thank you.