2 个解决方案
#1
declare @ID varchar(20)
set @ID='YCGK100817001'
while exists(select id from tb where tb.id=@ID)
begin
set @ID=substring(@ID,1,4)+cast(cast(substring(@ID,5,13) as int)+1 as varchar)
set id=@ID
end
#2
昨天系统维护,没看到,我已经解决了 谢谢
#1
declare @ID varchar(20)
set @ID='YCGK100817001'
while exists(select id from tb where tb.id=@ID)
begin
set @ID=substring(@ID,1,4)+cast(cast(substring(@ID,5,13) as int)+1 as varchar)
set id=@ID
end
#2
昨天系统维护,没看到,我已经解决了 谢谢