x002548's Blog

Not Just a Number - Brett Kaiser
posts - 89, comments - 586, trackbacks - 39

June 2010 Blog Posts

Next Available Date

Saw a post the other day on SQLTeam.   The OP Asked: "If I supply a Date, How can I get the next available date, that is not a holiday, and is not on the weekend."   I came up with this hack...please let me know if anyone has come with a different version   Thanks   Brett   CREATE TABLE Holidays (Holiday_Dt datetime, HoldayName varchar(255)) GO INSERT INTO Holidays(Holiday_Dt, HoldayName) SELECT '1/1/2010', 'New Years Day' UNION ALL SELECT '1/18/2010', 'Martin Luther King' UNION ALL SELECT '2/15/2010', 'President''s Day' UNION ALL SELECT '5/31/2010', 'Memorial Day' UNION ALL SELECT '7/5/2010', 'July 4th Holiday' UNION ALL SELECT '9/6/2010', 'Labor Day' UNION ALL SELECT '11/25/2010', 'Thanksgiving' UNION ALL SELECT '11/26/2010', 'Black Friday' UNION...

posted @ Wednesday, June 30, 2010 2:43 PM | Feedback (3) | Filed Under [ SQL Server ]

Powered by:
Powered By Subtext Powered By ASP.NET