加好友 发短信
等级:超级版主
帖子:521
积分:4910
威望:0
精华:7
注册:2008/9/2 22:22:00
|
Post By:2008/11/10 16:57:00 [显示全部帖子]
尽力简化一下吧:
非常【日满26则月进1】_年: Convert(SUBSTRING(Convert([日期],'System.String'),1,4),'System.Int16')+IIF(SUBSTRING(Convert([日期],'System.String'),6,5) in ('12-26','12-27','12-28','12-29','12-30','12-31'),1,0)
非常【日满26则月进1】_月: IIF(SUBSTRING(Convert([日期],'System.String'),6,5) in ('12-26','12-27','12-28','12-29','12-30','12-31'),1,Convert(SUBSTRING(Convert([日期],'System.String'),6,IIF(SUBSTRING(Convert([日期],'System.String'),7,1) = '-',1,2)),'System.Int16')+IIF(SUBSTRING(Convert([日期],'System.String'),8,3) in ('-26','-27','-28','-29','-30','-31','26','27','28','29','30','31'),1,0))
月底日期: SUBSTRING(Convert([日期],'System.String'),1,IIF(SUBSTRING(Convert([日期],'System.String'),7,1) = '-',7,8))+IIF(SUBSTRING(Convert([日期],'System.String'),6,IIF(SUBSTRING(Convert([日期],'System.String'),7,1) = '-',1,2))= 2,28+IIF(Convert(SUBSTRING(Convert([日期],'System.String'),1,4),'System.Int16') % 4 = 0, 1,0),IIF(Convert(SUBSTRING(Convert([日期],'System.String'),6,IIF(SUBSTRING(Convert([日期],'System.String'),7,1) = '-',1,2)),'System.Int16') In (1,3,5,7,8,10,12),31,30))
加n年日期: Convert(SUBSTRING(Convert([日期],'System.String'),1,4),'System.Int16')+[n]+SUBSTRING(Convert([日期],'System.String'),5,15)
[此贴子已经被作者于2008-11-11 9:00:29编辑过]
|
|