create proc GetMaxCode
@MaxCode char(6) output
as
select @MaxCode = max (code) from book
if @MaxCode is null
select @MaxCode = 'A00001'
else if @MaxCode = 'A99999'
return -1
else
select @MaxCode = 'A'+right('00000'+convert(varchar(5),convert(int,substring (@MaxCode,2,5))+1 ) ,5)
end
go
@MaxCode char(6) output
as
select @MaxCode = max (code) from book
if @MaxCode is null
select @MaxCode = 'A00001'
else if @MaxCode = 'A99999'
return -1
else
select @MaxCode = 'A'+right('00000'+convert(varchar(5),convert(int,substring (@MaxCode,2,5))+1 ) ,5)
end
go
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货