写错了,修改
string ls_bh
select count(*) into :count from table1 ;
select max(*) into :ls_max from table1 ;
if count = long(left(ls_max ,3)) then
ls_bh = "BS" +string(long(left(ls_max ,3)) + 1) //没有删除时
else
for i = 1 to count
ls_bh = "bs""BS" +string(i,"000")//格式化成“00i”
select count(*) into count1 from table1 where table1.bh = :ls_bh
if count1 < 1 then //没有该号时
ls_bh = "BS" +string(,"000")
exit //退出循环,此法速度较慢,可优化,如分段测试
end if
next
string ls_bh
select count(*) into :count from table1 ;
select max(*) into :ls_max from table1 ;
if count = long(left(ls_max ,3)) then
ls_bh = "BS" +string(long(left(ls_max ,3)) + 1) //没有删除时
else
for i = 1 to count
ls_bh = "bs"
select count(*) into count1 from table1 where table1.bh = "BS" +string(i,"000")//格式化成“00i”
if count1 < 1 then //没有该号时
ls_bh = "BS" +string(,"000")
exit //退出循环,此法速度较慢,可优化,如分段测试
end if
next
string ls_bh
select count(*) into :count from table1 ;
select max(*) into :ls_max from table1 ;
if count = long(left(ls_max ,3)) then
ls_bh = "BS" +string(long(left(ls_max ,3)) + 1)
else