I’m trying to make a table in Snowflake but it is giving me error due to default value. This seems to work fine in Oracle but not Snowflake.
CREATE TABLE A( DATES_DATE TIMESTAMP(3) DEFAULT TO_TIMESTAMP('1900-01-01', 'YYYY-MM-DD') );
Error-
SQL compilation error: Default value data type does not match data type for column DATES_DATE
Please let me know where I’m going wrong.
Advertisement
Answer
Please try this one:
CREATE or replace TABLE A( DATES_DATE TIMESTAMP DEFAULT TO_TIMESTAMP('1900-01-01', 'YYYY-MM-DD') );
Or
CREATE or replace TABLE A( DATES_DATE TIMESTAMP(3) DEFAULT TO_TIMESTAMP('1900-01-01', 'YYYY-MM-DD')::TIMESTAMP(3) );