create table Copy_T(date char(8),year char(4),month char(2),day char(2))
declare @s_date char(8),@e_date char(8)
select @s_date ='20070101',@e_date = '20071231'
while @s_date <= @e_date
begin
insert Copy_T values(@s_date,left(@s_date,4),substring(@s_date,5,2),right(@s_date,2))
set @s_date = convert(char(8),dateadd(d,1,@s_date),112)
end
select * from Copy_T
이걸 바꾸면..어떤식으로 되야하나요?
|