sql批量生成一年中的日期并插入
DECLARE @dt1 DATETIME
SET @dt1='2013-01-01'
insert into dd_trust_calendar(Date, SalesType)
SELECT @dt1+number,case Datepart(weekday, convert(datetime,@dt1+number)-1) when 5 then 'pk' when 6 then 'spk' else 'std' end AS dt
FROM master.dbo.spt_values AS a
WHERE type='P' AND @dt1+number<'2013-12-31'
本人博客的文章大部分来自网络转载,因为时间的关系,没有写明转载出处和作者。所以在些郑重的说明:文章只限交流,版权归作者。谢谢