If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > subtracting 2 hours from date returned

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-13-04, 14:52
aliaga61 aliaga61 is offline
Registered User
 
Join Date: Jan 2004
Posts: 36
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
Reply With Quote
  #2 (permalink)  
Old 01-14-04, 05:30
r123456 r123456 is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 01-14-04, 07:57
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
where row_date >= sysdate - interval '2' hour

__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #4 (permalink)  
Old 01-14-04, 07:59
aliaga61 aliaga61 is offline
Registered User
 
Join Date: Jan 2004
Posts: 36
thanks guys...appreciate the help
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On