How to Pass Data Value to where condition in Snow Flake

I have a requirement in which I need pass Current Date value to the where condition of a select statement.

Below is the code:

var step01 = `SELECT  CURRENT_DATE::DATE`;
var statement01 = snowflake.createStatement( {sqlText: step01} );
results1 = statement01.execute();
results1.next();
Var1 = results1.getColumnValue(1);
Var2 =`Insert into TableA ( ColA) select ColB from tableB
where cast(LOAD_DTTM as date) >= TO_DATE(''''${Var1}'''')`;

I am getting the following error. Could you please help.

Failed: Code: 100183
State: P0000
Message: Date 'Fri Mar 04 2022 00:00:00 GMT-0800 (Pacific Standard Time)' is not recognized
Stack Trace: undefined
0 0 92
0 REPLIES 0
Top Labels in this Space
Top Solution Authors