Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2010
    Posts
    14

    Unanswered: Delete Rows based on UTCTime

    I have rows with UTCTime as below. I want to remove those rows with Date earlier than certain dates, is it possible?

    say I only want those dates 2011-04-07 or later. How do I do it?
    I try this, but does not seem to work.

    USE DatabaseABC;
    GO
    DELETE FROM dbo.tblDownloadABC
    WHERE UTCTime < 2011-04-07;
    GO

    UTCTime
    2011-04-05 06:26:34.023
    2011-04-05 06:26:34.987
    2011-04-05 06:26:35.060
    2011-04-05 06:26:39.817
    2011-04-05 06:26:40.443
    2011-04-06 10:32:44.240
    2011-04-06 10:32:44.240
    2011-04-06 10:32:44.240
    2011-04-06 10:32:44.240
    2011-04-06 10:32:44.240
    2011-04-07 07:37:12.160
    2011-04-07 07:37:12.160
    2011-04-07 07:37:12.160
    2011-04-07 07:37:12.160
    2011-04-07 07:37:12.160
    2011-04-08 08:12:29.453
    2011-04-08 08:12:29.453
    2011-04-08 08:12:29.453

  2. #2
    Join Date
    Feb 2004
    Location
    Bangalore, India
    Posts
    250
    try this

    USE DatabaseABC;
    GO
    DELETE FROM dbo.tblDownloadABC
    WHERE UTCTime < '2011-04-07 00:00:00:000';
    GO
    Cheers....

    baburajv

  3. #3
    Join Date
    Sep 2011
    Posts
    31
    there is a type i guess
    '2011-04-07 00:00:00:000'
    the last colon should be replace with a period (.)
    '2011-04-07 00:00:00.000'

  4. #4
    Join Date
    Feb 2004
    Location
    Bangalore, India
    Posts
    250
    oh yes.. sorry for the typo.

    cindyaz,
    Thanks for the update
    Cheers....

    baburajv

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •