Skip to content
Advertisement

My last upload of data, the timestamp is off by 2 days, how can I fix it?

So I have a table in Snowflake that I uploaded and made the mistake of uploading some data with the incorrect datetime. The first few columns of the table are different json results, that correspond to the date they were fetched.

Example:

name        date
0  [{},{},{},{},{}]   8/20/2019
1              [{}]  12/22/2019
2     [{},{},{},{}]  11/15/2019
3        [{},{},{}]   1/10/2019
4     [{},{},{},{}]   12/1/2019

The INSERT was pretty straight forward, I staged the file and inserted it into an already created table.

I want to go in and change the date by two days, and will make a note to change how I am generating the date and data, so I don’t have to do this manually anymore.

Is is possible to correct the column for a certain set of ids instead of a date range like I did below?

ALTER TABLE json_date ALTER COLUMN date Where date >"12-01-2019" and date < "12-30-2019" dateadd(day,2,date);

Advertisement

Answer

If this is simply a column, then you would use update:

update json_date
    set date = dateadd(day, 2, date)
    where date > '2019-12-01';
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement