Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    36

    Unanswered: subtracting 2 hours from date returned

    I am trying to set up a job in sql server that will run an asp file...the file connects to an oracle database and runs a query on all rows in a table with a date that falls between the current system date and the time the job was last run (2 hours)

    what would the syntax be for "where row_date >= sysdate - 2hours"?

    thanks

  2. #2
    Join Date
    Sep 2003
    Location
    The extremely Royal borough of Kensington, London
    Posts
    778
    select * from table
    where to_char(rowDATE, 'DD-MON-YY:HH24') >= SYSDATE||':'||(to_char(SYSDATE, 'HH24')-2);
    Bessie Braddock: Winston, you are drunk!
    Churchill: And Madam, you are ugly. And tomorrow, I'll be sober, and you will still be ugly.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    where row_date >= sysdate - interval '2' hour

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  4. #4
    Join Date
    Jan 2004
    Posts
    36
    thanks guys...appreciate the help

Posting Permissions

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