SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Extract tickets with time.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Makaio780
Starting Member

Canada
24 Posts

Posted - 06/27/2012 :  13:17:46  Show Profile  Reply with Quote
select Incident_Number,Reported_date
From vars76_Hpd_help_desk
where reported_date > @startdate and reported_date < @startdate

How can i extract tickets that are between 7am and 5pm when parameters entered are 5/1/2012 and 6/1/2012.

Ron Cheung

jimf
Flowing Fount of Yak Knowledge

USA
2865 Posts

Posted - 06/27/2012 :  13:24:36  Show Profile  Reply with Quote
add
and DATEPART(Hour,ReportDate) BETWEEN 7 and 17

Jim

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

Makaio780
Starting Member

Canada
24 Posts

Posted - 06/27/2012 :  13:43:46  Show Profile  Reply with Quote
Thanks!!!!

Ron Cheung
Go to Top of Page

Makaio780
Starting Member

Canada
24 Posts

Posted - 06/27/2012 :  14:16:44  Show Profile  Reply with Quote
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
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000