Created
February 7, 2013 23:41
-
-
Save tun/4735279 to your computer and use it in GitHub Desktop.
Set availability for a full year, except sundays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @start_date DATETIME, @end_date DATETIME | |
SET @start_date = '2014-01-01' | |
SET @end_date = '2014-12-31' | |
WHILE @start_date <= @end_date | |
BEGIN | |
--PRINT @start_date | |
IF datepart(weekday, @start_date) = 1 | |
INSERT INTO tblAvailability(avDate, avNumber) VALUES(@start_date, 0) | |
ELSE | |
INSERT INTO tblAvailability(avDate, avNumber) VALUES(@start_date, 120) | |
SET @start_date = DATEADD(DAY, 1, @start_date) | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment