[msslq]요일 구하기


Declare @iWeek int --요일 : 1:일요일 2:월요일 3:화요일 4:수요일 5:목요일 6:금요일 7:토요일
Declare @NowDate DateTime -- 오늘날짜

Declare @MON int --월
Declare @TUE int --화
Declare @WED int --수
Declare @THU int --목
Declare @FRI int --금
Declare @SAT int --토
Declare @SUN int --일

Set @MON = 0
Set @TUE = 0
Set @WED = 0
Set @THU = 0
Set @FRI = 0
Set @SAT = 0
Set @SUN = 0

Set @NowDate = CONVERT(CHAR(10),GETDATE(), 23) -- fomat: 03 30 2012 12:00AM

Print @NowDate

if @iWeek=1 --일요일
begin
Set @SUN = 0
end