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)
 If Time Between

Author  Topic 

Girlnet
Yak Posting Veteran

77 Posts

Posted - 2008-02-19 : 21:47:43
Guys,

I'm really stumped on this. I need to take a date - a RunDate to be exact, evaluate it to see if it's between the hours of 10:00PM and 12:00PM. If it is during that time, the RunDate needs to increment by 1 day.

I've been searching around for the last hour and just not getting it. Someone please help me out. Pretty please.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2008-02-19 : 22:01:26
[code]
case
when datepart(hour,Rundate) between 13 and 21
then RunDate
else dateadd(day,1,Rundate)
end
[/code]

CODO ERGO SUM
Go to Top of Page

Girlnet
Yak Posting Veteran

77 Posts

Posted - 2008-02-20 : 06:58:43
Thank you!!!
Go to Top of Page
   

- Advertisement -