Reputation: 145
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.
Upvotes: 1
Views: 1573
Reputation: 175994
Using '1900-01-01'::TIMESTAMP(3)
:
CREATE OR REPLACE TABLE A(
DATES_DATE TIMESTAMP(3) DEFAULT '1900-01-01'::TIMESTAMP(3)
);
Upvotes: 1
Reputation: 10134
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)
);
Upvotes: 1