DateTime Question

  •  

    I have a 2006 table with a column called DateTime.  At midnight, the date is the next day and each row's time are blank. (e.g. 1/1/2007         ).  I would like for each data row at midhight to be previous day's date and the following time (e.g. 12/31/2006 11:59:00)

    How do I perform an update query to correct all DateTime entries for the 2006 data table?

     

    In otherwords, how do I subtract a day off the date and set time to 11:59:00 for all entries at midnight?

     

    Thanks

    sql2day

     

  • Try using DATEADD(ms,-1,your_date)

    Take care,

    Bert

    "Speculations? I know nothing about speculations. I'm resting on certainties. I know that my Redeemer lives, and because He lives, I shall live also." - Michael Faraday

  • Would I select all DateTime records that are midnight then update with dateadd function?

     

     

  • Yes

     

    Take care,

    Bert

    "Speculations? I know nothing about speculations. I'm resting on certainties. I know that my Redeemer lives, and because He lives, I shall live also." - Michael Faraday

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply