update maxbh set biaoshi=@djlx where biaoshi=@djlx
set @rowcount=@@rowcount
select @maxbh=maxbh from maxbh where biaoshi=@djlx -- 取当前最大编号
set @maxbh=@djlx+REPLICATE('0',11-len(right(@maxbh,8)+1)-3) +ltrim(str(right(@maxbh,8)+1))
update maxbh set maxbh=@maxbh where biaoshi=@djlx -- 更新
if @rowcount=0
begin
set @maxbh=@djlx+REPLICATE('0',11-len(@djlx))
insert into maxbh (biaoshi,maxbh) values (@djlx,@maxbh)
end