标签:sql tis get max statsd sda time arch char
declare @ctrBeginTime =null;
if(@ctrBeginTime Is NUll)
begin
set @ctrBeginTime= GETDATE();
end
declare @statisticsDate as datetime = CONVERT(varchar(10),@ctrBeginTime,120); /*统计时间*/
declare @ThisYear1stDay as datetime = DATEADD(yy, DATEDIFF(yy,0,@statisticsDate),0); /*本年的第一天*/
declare @LastYearLastDay as datetime = DATEADD(dd,-1,@ThisYear1stDay); /*去年的最后一天*/
declare @LastYear1stDay as datetime = DATEADD(yy, DATEDIFF(yy,0,@LastYearLastDay),0); /*去年的第一天*/
declare @LastYearMaxStatsDate as datetime = @LastYearLastDay;/*去年的最后一次统计时间*/
标签:sql tis get max statsd sda time arch char
原文地址:http://www.cnblogs.com/easy5weikai/p/8004819.html