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
 General SQL Server Forums
 New to SQL Server Programming
 Time in Hourly
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

peace
Constraint Violating Yak Guru

410 Posts

Posted - 09/10/2013 :  05:03:41  Show Profile  Reply with Quote
I need to convert to dateadd Hour 8 to get the current time. Will like to schedule a job to run every hour.

How can I apply it in where condition?

select dateadd(hour,8,GETDATE())

0000-0100
0100-0200
0200-0300
'
'
'
'

bandi
Flowing Fount of Yak Knowledge

India
2218 Posts

Posted - 09/10/2013 :  06:18:12  Show Profile  Reply with Quote
1) Create one table with Time slots as follows:
StartTime EndTime
0000 0100
0100 0200
0200 0300

While retrieving data use as follows:
SELECT * FROM SourceTable
WHERE TimeColumn BETWEEN StartTime AND EndTime


--
Chandu

Edited by - bandi on 09/10/2013 06:19:41
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.03 seconds. Powered By: Snitz Forums 2000