Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin.
Search for scripts directly from SSMS, and instantly access any saved scripts in your
SSC briefcase from the favorites tab.
Download now (direct download link)
Thank this author by sharing:
By Boyd Tyrrell,
You will need to use the Date Calendar script created by Sean Smith on the SQL Server Central website here http://www.sqlservercentral.com/scripts/Date/68389/ This is a great tool Sean wrote, if you have not seen it!
Then modify it to add a column is_workday. Just add a column in the CREATE TABLE section after is_weekday, add an is_workday column. Then scroll down to the UPDATE for is_weekday and copy that code and paste new renaming it is_workday. Run Sean's script and you will now have an is_workday column populated with the same values as is_weekday.
Once you have your Date Calendar table, you can run this Calculate Holidays script (U.S. holidays only) to flag the is_workday column for holidays. You will need to remark or modify holidays based on your business rules.
We use this to schedule business due dates for tasks of length n, so our deliverables timelines skip weekends and holidays.
Find number of weekdays
TSQL copy data in weekdays
Sergiy, this goes with my last trigger post, but this is kind of a new topic. I made a test table f...
I want to populate records in my one of the column as per below,
count of non...
Do you know what happens if a holiday falls on a weekend? This script will help you.