﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by zulmanclock  / Number of Working Days / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 22:56:12 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Number of Working Days</title><link>http://www.sqlservercentral.com/Forums/Topic1417450-2875-1.aspx</link><description>Your answer told me that I was having problems with the browser (Chrome). Tried it with Firefox - works well.</description><pubDate>Mon, 11 Feb 2013 11:41:33 GMT</pubDate><dc:creator>Dave Vroman</dc:creator></item><item><title>RE: Number of Working Days</title><link>http://www.sqlservercentral.com/Forums/Topic1417450-2875-1.aspx</link><description>[quote][b]Dave Vroman (2/8/2013)[/b][hr]Couldn't get yours to work. Too many errors in the post. We're using this one. I wanted to see the difference. The table of holidays contains only holidays that fall on business days.[code]CREATE FUNCTION [dbo].[CalculateBusinessDays](    @StartDate DATE,    @EndDate DATE)RETURNS INTEGERASBEGIN    IF @EndDate IS NULL        SELECT @EndDate = GETDATE()    RETURN  CONVERT(INTEGER,         (DATEDIFF(dd, @StartDate, @EndDate) + 1)       - (DATEDIFF(wk, @StartDate, @EndDate) * 2)       - (CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)       - (CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)       - ISNULL((SELECT COUNT(*) FROM tblHoliDays                 WHERE @StartDate &amp;lt;= Holiday AND @EndDate &amp;gt;= Holiday), 0))END[/code][/quote]What sorts of errors are you getting when you try to run the function?</description><pubDate>Sat, 09 Feb 2013 08:48:38 GMT</pubDate><dc:creator>zulmanclock</dc:creator></item><item><title>RE: Number of Working Days</title><link>http://www.sqlservercentral.com/Forums/Topic1417450-2875-1.aspx</link><description>Couldn't get yours to work. Too many errors in the post. We're using this one. I wanted to see the difference. The table of holidays contains only holidays that fall on business days.[code]CREATE FUNCTION [dbo].[CalculateBusinessDays](    @StartDate DATE,    @EndDate DATE)RETURNS INTEGERASBEGIN    IF @EndDate IS NULL        SELECT @EndDate = GETDATE()    RETURN  CONVERT(INTEGER,         (DATEDIFF(dd, @StartDate, @EndDate) + 1)       - (DATEDIFF(wk, @StartDate, @EndDate) * 2)       - (CASE WHEN DATENAME(dw, @StartDate) = 'Sunday' THEN 1 ELSE 0 END)       - (CASE WHEN DATENAME(dw, @EndDate) = 'Saturday' THEN 1 ELSE 0 END)       - ISNULL((SELECT COUNT(*) FROM tblHoliDays                 WHERE @StartDate &amp;lt;= Holiday AND @EndDate &amp;gt;= Holiday), 0))END[/code]</description><pubDate>Fri, 08 Feb 2013 17:38:38 GMT</pubDate><dc:creator>Dave Vroman</dc:creator></item><item><title>Number of Working Days</title><link>http://www.sqlservercentral.com/Forums/Topic1417450-2875-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Workdays/95876/"&gt;Number of Working Days&lt;/A&gt;[/B]</description><pubDate>Thu, 07 Feb 2013 21:07:37 GMT</pubDate><dc:creator>zulmanclock</dc:creator></item></channel></rss>