in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Formatting date time in the where clause for an update query

Last post 03-06-2008 8:12 AM by bd_epa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-05-2008 5:51 PM

    • bd_epa
    • Top 500 Contributor
    • Joined on 03-05-2008
    • Posts 4

    Formatting date time in the where clause for an update query

    I am writingn an update query where I have to specify a date time value to correctly update the right row in a table.

     The date time is currently stored as 5/20/2008 12:00:00 AM.  When I write my update query and use this particular date time, however, it does not update the row.

    My query looks like the following: Update raw_data set value = @value where variable_id = 'wave' and entry_date='5/20/2008 12:00:00 AM'.

     I have tried parameter queries, but they also failed to work. Can anyone offer advice on this issue?

     

    Thanks,

    Ben

    Filed under: ,
  • 03-06-2008 8:12 AM In reply to

    • bd_epa
    • Top 500 Contributor
    • Joined on 03-05-2008
    • Posts 4

    Re: Formatting date time in the where clause for an update query

    Again, I've answered my own question.  I'm becoming my own favorite poster ;-)

     To do date comparison in the where clause use an expression like this:

     (entry_date = strftime('%Y-%m-%d', '2008-05-20'))

Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems