We help IT Professionals succeed at work.

Calculate the days between two dates in SQL

I have a sql table with two dates and I want to run a query showing the two dates with a calculated field showing the difference in number of days between these two dates.  However the trick is I only want the calulated field to return the number of working days between the dates that is the number of Mondays to Fridays between to dates substracing all weekend days.
Watch Question

Software Architect
Top Expert 2005
Guy Hengel [angelIII / a3]Billing Engineer
Most Valuable Expert 2014
Top Expert 2009

usually you use a calendar table for this:

with this, you just to a count(*) from the records from that table between the start and end date, skipping the records that are not "week-end" (or holiday)