Need script to list records that were updated on a given date

  • I have a table with a ModDate column - DBDate datetime (8). I'd like to quickly list the records that were updated on a given date. e.g. on 1/28/2005.

    Does anyone have a script that they use to do this?

     

    Thanks

  • select * from table

    where DBDate between '01/28/2005' and '01/29/2005'

    You just have to remember that '01/28/2005' really means '01/28/2005 00:00:00.000' when compared to a datetime.

    Greg

    Greg

  • Thanks Greg. I tried that, but it doesn't work.

    select * from table

    where DBDate between '01/28/2005' and '01/29/2005'

    Doesn't return any records.

    If I change it to:

    select * from table

    where DBDate between '01/27/2005' and '01/29/2005'

    I only get records for 1/27/2005.

     

  • Looks like it's working to me.  Maybe there aren't any rows with a DBDate of 1/28/2005.

    Try the select where DBDate > '01/27/2005' and see what you get.

    Greg

    Greg

  • My bad. You're right, the first script is best. My test db was restored from last night's backup after today's updates were applied.

    Thanks

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

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