when 1 then '000'+rtrim(ltrim(@tmpprenum))
when 2 then '00'+ rtrim(ltrim(@tmpprenum))
when 3 then '0'+ rtrim(ltrim(@tmpprenum))
when 4 then rtrim(ltrim(@tmpprenum))
end
-----------------------------------------------------------------------------------------------------------------
set @year1 =right(ltrim(rtrim((str(year(@prctmpdate ))))),2) --取出年份
select @month1=
case len (ltrim(str(month(@prctmpdate)))) --取出月份,若不够两位的补够两位
when 1 then '0'+ltrim(str(month(@prctmpdate )))
when 2 then ltrim(str(month(@prctmpdate )))