--달력테이블//
create table Calendar (
idx [int] IDENTITY (1, 1) NOT NULL ,
yyyy char(4) not null,
mm char(2) not null,
dd char(2) not null,
flag char(1) not null
)
--//입력쿼리
insert into Calendar
select
SUBSTRING(CONVERT(VARCHAR(8), GETDATE(),112),1,4) as yyyy,
SUBSTRING(CONVERT(VARCHAR(8), GETDATE(),112),5,2) as mm,
SUBSTRING(CONVERT(VARCHAR(8), GETDATE(),112),7,2) as dd ,
case datepart("dw", getdate())
when 1 then '0'
when 2 then '1'
when 3 then '1'
when 4 then '1'
when 5 then '1'
when 6 then '1'
when 7 then '0'
end as B
이렇게 만들어 놓고서
2005년 12월부터 2006년 12월까지의 날짜를 입력하려고 합니다.
어떻게 루프를 돌리면 되는지 알려 주세요
|