SQL Clone
SQLServerCentral is supported by Redgate
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: 279 | Views in the last 30 days: 2
Related Articles

how to schedule execution of stored procedures daily ?

I want to schedule my stored procedures


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...


Execute the Database Mail Stored procedures in scheduler

Execute the Database Mail Stored procedures in scheduler