Populating table of shifts

  • I need help writing a script to populate a table with shift times (start date and time and end date and time for each shift from now to future date - ie 15 years from now.) that have a varying pattern as described below.

    Table Definition

    Shift - varchar(10)

    BeginDatetime - datetime

    EndDatetime -datetime

    Shift 1 8:00- 20:00

    Shift 2 20:00 - 8:00

    Shift 3 8:00 - 20:00

    Shift 4 20:00 - 8:00

    repeating Pattern

    1, 2, 3, 4, 3, 4, 1, 2, 1, 2, 1, 2, 1, 2, 3, 4, 1, 2, 1, 2, 3, 4, 3, 4, 3, 4, 3, 4

  • Why don't you store the pattern in a different table so you can just replicate it any times you need?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply