Search code examples
sqlsnowflake-cloud-data-platformdata-warehouse

Timestamp '"2013-08-19 09:50:37.000"' is not recognized


In snowflake I am trying to do the following command:

copy into trips from @citibike_trips
file_format=CSV;

Before this command, I have already created a table:

CREATE TABLE "CITIBIKE"."PUBLIC"."TRIPS" 
    ("TRIPDURATION" INTEGER
      , "STARTTIME" TIMESTAMP
      , "STOPTIME" TIMESTAMP
      , "START_STATION_ID" INTEGER
      , "START_STATION_NAME" STRING
      , "START_STATION_LATITUDE" FLOAT
      , "START_STATION_LONGITUDE" FLOAT
      , "END_STATION_ID" INTEGER
      , "END_STATION_NAME" STRING
      , "END_STATION_LATTITUDE" FLOAT
      , "END_STATION_LONGITUDE" FLOAT
      , "BIKEID" INTEGER
      , "MEMBERSHIP_TYPE" STRING
      , "USERTYPE" STRING
      , "BIRTH_YEAR" INTEGER
      , "GENDER" INTEGER);

Now by typing the command copy into trips from @citibike_trips file_format=CSV;

I am receiving the error: Timestamp '"2013-08-19 09:50:37.000"' is not recognized

I have already tried the solution, which I found on the Internet, which would be:

ALTER citibike SET  TIMESTAMP_INPUT_FORMAT  = 'yyyy/mm/dd HH24:MI:SS';

But this is not helping. It is also not helping, if I try to use 'yyyy/mm/dd' or 'AUTO'

Does anyone have any idea how to solve this?


Solution

  • Look at the error message very closely, especially the highlighted parts:

    Timestamp '"2013-08-19 09:50:37.000"' is not recognized

    Your timestamp format YYYY-MM-DD HH24:MI:SS.FF3 is correct, but the string includes double quotes. You can specify FIELD_OPTIONALLY_ENCLOSED_BY = '\042' in your file format to correct this.