Sqlite: update DATE column, but change date only - preserve time
I need to update the actual date of a ton of rows, but preserve the time already in there. A script started incorrectly populating the rows incorrectly due to a programming error. I could proba开发者_高级运维bly do this via an external script, but I figure there has to be a sqlite command to do this easily.
The column is described as this in the schema:
logDate DATE NOT NULL,
A sample row looks like this:
data8|dat7|200|2011--08 00:15|12
It SHOULD look like this:
data8|dat7|200|2011-01-08 00:15|12
It's done this for the past 10 days. I can do individual updates for the past 10 days, or one big one, but I really am not sure where to start. I haven't found much via googling. If I do, I'll answer my own question.
Thanks in advance.
So I just did this:
UPDATE views SET logDate = REPLACE(logDate,'--','-01-')
WHERE logDate LIKE '2011%';
Worked fine.
精彩评论