Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Current Date - 72 hours Function?

Author  Topic 

drew22299
Starting Member

26 Posts

Posted - 2007-02-21 : 09:12:56
Can anyone help me with this, I need to search for all records from the current date - 72 hours. How can this be done?

Thanks,

www.myspace.com/drew22299

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-21 : 09:14:01
[code]
where somedatecol >= dateadd(hour, -72, getdate())
[/code]


KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-21 : 09:15:16
72 hours is really 72 hours, or 3 full days?

select * from sometable
where somedatetimecolumn >= dateadd(hour, -72, current_timestamp)


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -