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)
 time parameters

Author  Topic 

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2009-09-21 : 18:14:24
I'm trying to set default StartDateTime and EndDateTime parameters in a SQL Business Report.

What is the syntax for my StartDateTime of yesterday's date at 6am? And, what is the syntax for my EndDateTime of today's date at 6am?

Any help would be greatly appreciated.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-09-21 : 21:21:50
[code]
select dateadd(hour, 6, dateadd(day, datediff(day, 0, getdate()), -1)),
dateadd(hour, 6, dateadd(day, datediff(day, 0, getdate()), 0))
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -