实名认证用户熊川湘 身份证号码430811198506290914

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'

posted @ 2012-07-30 15:19  浪达短信群发  阅读(427)  评论(0编辑  收藏  举报