Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Time in Hourly
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

420 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())


Flowing Fount of Yak Knowledge

2242 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


Edited by - bandi on 09/10/2013 06:19:41
Go to Top of Page
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000