Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

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)

Decimal to Binary Conversion for event scheduling

By jisommer,

This procedure was written to create an event schedule
    where the schedule may have non-consecutive days.
    The input for the procedure is START DATE, END DATE, and DAYMAP
    The DAYMAP input parameter is a decimal number whose binary representation
    describes the schedule days over potentially a 4 week period (read from right to left).
    For example: 0000000000000001101100110110 Decimal 6966
    represents a schedule of (week#-Day): 1-Mon 1-Tue 1-Thu 1-Fri 2-Mon 2-Tue 2-Thu 2-Fri
    This examples is partitioned into 4 sessions (at least one day is skipped)
    This procedure determines the days of week for the schedule,
    session dates, and duration of each session.
    There are several print statements in the procedure so you can see some
    intermediate results.

Total article views: 277 | Views in the last 30 days: 1
Related Articles

SQL Saturday #70 - Columbia, SC 2011 Session Schedule Is Up!

As announced, we have posted our session schedule for SQL Saturday #70 - Columbia, SC.  The event wi...


how to schedule execution of stored procedures daily ?

I want to schedule my stored procedures


Execute the Database Mail Stored procedures in scheduler

Execute the Database Mail Stored procedures in scheduler


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones