SQL Server 输出日历
--源文收集于网络
方法一:
createfunctionfn_Calendar(@yearint,@monthint)
<shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>returnsnvarchar(max)
<shape id="_x0000_i1026" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>as
<shape id="_x0000_i1027" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>begin
<shape id="_x0000_i1028" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>declare@resultnvarchar(max),@Enternvarchar(8)
<shape id="_x0000_i1029" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>select@Enter=char(13)+char(10),@result='SunMonTheWedThuFriSta'+@Enter--表头
<shape id="_x0000_i1030" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>declare@startdatetime,@enddatetime
<shape id="_x0000_i1031" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>select@start=rtrim(@year)+'-'+rtrim(@month)+'-1',@end=dateadd(mm,1,@start)
<shape id="_x0000_i1032" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape><shape id="_x0000_i1033" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>set@result=@result+replicate('',(datepart(dw,@start)+@@datefirst+6)%7)--第一行前面的空格
<shape id="_x0000_i1034" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>whiledatediff(d,@start,@end)>0
<shape id="_x0000_i1035" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>begin
if(datepart(dw,@start)+@@datefirst)%7=1
<shape id="_x0000_i1036" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>select@result=@result+@Enter--是否换行
<shape id="_x0000_i1037" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>select@result=@result+right(''+rtrim(day(@start)),4),@start=dateadd(d,1,@start)
<shape id="_x0000_i1038" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>end
<shape id="_x0000_i1039" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>return@result
<shape id="_x0000_i1040" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>end
<shape id="_x0000_i1041" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>go
<shape id="_x0000_i1042" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>
<shape id="_x0000_i1043" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>setdatefirst3
<shape id="_x0000_i1044" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>printdbo.fn_Calendar(2007,12)
<shape id="_x0000_i1045" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>selectdbo.fn_Calendar(2007,12)
<shape id="_x0000_i1046" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>setdatefirst7
<shape id="_x0000_i1047" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>dropfunctiondbo.fn_Calendar
<shape id="_x0000_i1048" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>
<shape id="_827_1262_Open_Image" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt="" o:spid="_x0000_i1049"><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image002.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif"></imagedata></shape><shape id="_827_1262_Closed_Image" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt="" o:spid="_x0000_i1050"><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image003.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif"></imagedata></shape>/*
<shape id="_x0000_i1051" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>SunMonTheWedThuFriSta
<shape id="_x0000_i1052" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>1
<shape id="_x0000_i1054" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>2345678
<shape id="_x0000_i1055" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>9101112131415
<shape id="_x0000_i1056" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>16171819202122
<shape id="_x0000_i1057" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>23242526272829
<shape id="_x0000_i1058" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>3031
<shape id="_x0000_i1059" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>
<shape id="_x0000_i1060" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>------------------------------------------ <shape id="_x0000_i1061" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>SunMonTheWedThuFriSta <shape id="_x0000_i1062" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>1
<shape id="_x0000_i1079" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>2345678
<shape id="_x0000_i1053" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>9101112131415
<shape id="_x0000_i1063" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>16171819202122
<shape id="_x0000_i1064" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>23242526272829
<shape id="_x0000_i1066" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>3031
<shape id="_x0000_i1067" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>
<shape id="_x0000_i1068" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image004.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif"></imagedata></shape>(1row(s)affected)
<shape id="_x0000_i1069" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image005.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif"></imagedata></shape>*/
方法二:
createfunctionf_calendar(@yearint,@monthint)
<shape id="_x0000_i1070" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>returns@ttable(日varchar(4),一varchar(4),二varchar(4),三varchar(4),四varchar(4),五varchar(4),六varchar(4))
<shape id="_x0000_i1071" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>as
<shape id="_x0000_i1072" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>begin
<shape id="_x0000_i1073" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>declare@atable(idintidentity(0,1),datedatetime)
<shape id="_x0000_i1074" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>insertinto@a(date)
<shape id="_x0000_i1065" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>selecttop31rtrim(@year)+'-'+rtrim(@month)+'-1'fromsysobjects
<shape id="_x0000_i1075" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>update@asetdate=dateadd(dd,id,date)
<shape id="_x0000_i1076" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>insertinto@t
<shape id="_x0000_i1077" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>select
<shape id="_x0000_i1078" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>max(casedatepart(dw,date)when7thenrtrim(day(date))else''end),
<shape id="_x0000_i1080" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>max(casedatepart(dw,date)when1thenrtrim(day(date))else''end),
<shape id="_x0000_i1081" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>max(casedatepart(dw,date)when2thenrtrim(day(date))else''end),
<shape id="_x0000_i1082" style="WIDTH: 8.25pt; HEIGHT: 12pt" type="#_x0000_t75" alt=""><imagedata src="file:///C:%5CDOCUME~1%5Cwei_zhu%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.gif" o:href="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif"></imagedata></shape>max(casedatepart(dw,date)when3thenfont-size: 9pt; color: black; font-family: Verda