Greetings!

I am trying to write a simple applicaton in C# that will remove all data older 
than 30 days from an SQLite table.  However, my application is removing all 
data, not just the old data.

Before I run my query, the value_timestamp field of my table contains:

2009-05-07 17:00:43

My query is:

delete from trend_data where datetime(value_timestamp) < '4/7/2009 12:37:32 PM'

I'm sure I'm running into the fact that SQLite allows a user to store any type 
of data in any field.  So, SQLite has to decide whether to convert the left 
side to a string or the right side to a datetime.  It appears that it is 
choosing to convert the left side.  And, going by what I saw in SQLiteSpy, the 
first character of the conversion is '2', which is less than '4', so this row 
is deleted.

Do I merely have to use the datetime() method on the right side as well?

delete from trend_data where datetime(value_timestamp) < datetime('4/7/2009 
12:37:32 PM')

Or is there something else I should be doing?

Thanks very much!

RobR


      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to