TRUNCATE TABLE SYS_DATEINFO
declare @i int 
set @i=-30000
WHILE @i<1000000
BEGIN 

INSERT INTO SYS_DATEINFO
 SELECT DateName(year,GetDate()+@i)  YYYY, DateName(month,GetDate()+@i)  DD,DateName(DAY,GetDate()+@i)  MM,
 DateName(year,GetDate()+@i)  +''+ DateName(month,GetDate()+@i)  YYYYDD
 ,CONVERT(varchar(100), GETDATE()+@i, 23) RQ,CONVERT(varchar(100), GETDATE()+@i, 112)RQS,   datepart(weekday, getdate()+@i)XQY ,case datepart(weekday, getdate()+@i)when 1 then'星期天'when 2 then'星期一'when 3 then'星期二'when 4 then'星期三'when 5 then'星期四'when 6 then'星期五'when 7 then'星期六'END XQZ  
 SET @i=@i+1 PRINT @i 
end  
 

  

 posted on 2020-04-25 22:25  代码改变世界&1024  阅读(859)  评论(0编辑  收藏  举报