查询语句,最大值+1
select max(DetailSerial) from admin.Holiday
结果:
HY0000062094
如何通过查询语句得到HY0000062095
------解决方案--------------------select left(max(DetailSerial),2)+
right( '0000000000 '+cast(cast(max(DetailSerial) as bigint)+1 as varchar(10)),10)
from admin.Holiday
------解决方案--------------------Select Left(max(DetailSerial), 2) + Right(10000000000 + Cast(Stuff(max(DetailSerial), 1, 2, ' ') As Int) + 1, 10) from admin.Holiday