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
 General SQL Server Forums
 New to SQL Server Programming
 Sum datediff with minus weekend

Author  Topic 

calvinkwoo3000
Yak Posting Veteran

98 Posts

Posted - 2012-03-22 : 00:04:09
Dear expertise and admin,

how do i sum a datediff with minus out the weekend(saturday and sunday).
thank you.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-22 : 00:06:24
Best is you have a calendar table. Then you can also exclude public holiday etc


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

calvinkwoo3000
Yak Posting Veteran

98 Posts

Posted - 2012-03-22 : 00:09:11
quote:
Originally posted by khtan

Best is you have a calendar table. Then you can also exclude public holiday etc


KH
[spoiler]Time is always against us[/spoiler]





khtan, yes i have a holiday table,
how do i able to minus it together?
our holiday is declare from and to date...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-22 : 00:15:49
if you don't have a calendar table, it is worth while to create one. It make things much easier.

If you don't have one, you can consider MVJ's F_TABLE_DATE


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

calvinkwoo3000
Yak Posting Veteran

98 Posts

Posted - 2012-04-02 : 05:33:40
quote:
Originally posted by khtan

if you don't have a calendar table, it is worth while to create one. It make things much easier.

If you don't have one, you can consider MVJ's F_TABLE_DATE


KH
[spoiler]Time is always against us[/spoiler]





Mr khtan,

Yes, i copy the whole code and run it once....
do i need to run it for every database or no need?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-04-02 : 05:35:54
yes. You need to run it for every database that you required this function


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -