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 2008 Forums
 Transact-SQL (2008)
 Calculating dates based on business hours

Author  Topic 

srini4573
Starting Member

1 Post

Posted - 2012-09-08 : 14:50:32
I have a table which contains the business hours for a week (like following). Business hours definition need not be all weekdays (it may contain few few week days also). Some times it contains all week days.

Monday -- 9:00 AM - 4 PM
TuesDay -- 10:00 AM - 4 PM
Friday -- 8:00 AM - 2 PM.

Now, I have user defined integer value for the approvals. Means if I submit the proofs now admin should approve these proofs by defined value. While submitting proofs I need to send out an email saying that you need to approve the proofs by xxx date.

If I send the file after business hours of any day it should start the count from next business day.

Ex: Above is the business hours data and my defined approval time is 11 hours then I need to send out an email saying that you need to approve the proofs by Friday (with date) 1 P.M...

In the above example if the approve time is 13 hours then I need to say approve by Monday (with date) 12 P.M

I want to develop this in SQL Server 2008 (query or SP)...

Any help is appriciated....

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-09 : 12:29:24
see this logic

http://visakhm.blogspot.com/2010/03/calculating-business-hours.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -