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)
 Added Date Range of Sat and Sun from 7am -5pm

Author  Topic 

Makaio780
Starting Member

24 Posts

Posted - 2012-06-27 : 15:35:04
select Incident_Number,Reported_date
From vars76_Hpd_help_desk
where reported_date > '6/1/2012'
AND reported_date < '6/14/2012'
AND (((DATEPART(Hour,Reported_Date) BETWEEN 5 and 22) and (DATEPART(Weekday,Reported_date) Between 2 and 6))
Order by reported_date asc

How would i add time frame of Saturday and Sunday from 7am to 5pm?


Ron Cheung

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2012-06-27 : 17:01:01
add

or (DATEPART(hour,Reported_Date) BETWEEN 7 and 17 and DATEPART(Weekday,Reported_date) in (1,7)
)

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page

JadeV
Yak Posting Veteran

62 Posts

Posted - 2012-07-12 : 12:19:10
Hi ,
How can you define the Reported_date where the Reported_date does not have available field in the database?
For example:
StartDate
EndDate

I want to have a field DurationDate between StartDate and EndDate to check for the weekend day and holidays?

How would I do?

Jade

Go to Top of Page
   

- Advertisement -