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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 I Need help to query the last 24 hours.

Author  Topic 

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2010-09-09 : 12:18:55
Hi Group:

Enclosed is my current query. I need to change my query to find the results for the last 24 hours. Any help is appreciate it.

Thank you.


FROM:
SET @StartDate = CAST((ROUND(CAST(GetDate() - 7 AS FLOAT), 0, 1)) as datetime)


TO:
SET @StartDate = GetDate()-1

MSquared
Yak Posting Veteran

52 Posts

Posted - 2010-09-09 : 12:29:24
select DateAdd(hh, -24, GetDate())

For Faster results please follow the posting guidelines here

http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

osirisa
Constraint Violating Yak Guru

289 Posts

Posted - 2010-09-09 : 12:31:08
Thank you MSquared.
Go to Top of Page
   

- Advertisement -