Ok it is late in the day but can someone help?
declare @x int, @prefix char(30)
declare @breakout_no char(10)
set @breakout_no = '19999999'
set @prefix = ''
set @x = len(@breakout_no)
print @prefix
while @prefix <> @breakout_no
begin
print @x
set @breakout_no = substring (@breakout_no,1,@x)
print @breakout_no
set @prefix = (select prefix
from rate_plan
where prefix = @breakout_no and rate_plan_index = 1)
print 'prefix'
print @prefix
set @x = @x -1
end
select call_price
from rate_plan
where prefix = @prefix and rate_plan_index = 1
thanks a million
declare @x int, @prefix char(30)
declare @breakout_no char(10)
set @breakout_no = '19999999'
set @prefix = ''
set @x = len(@breakout_no)
print @prefix
while @prefix <> @breakout_no
begin
print @x
set @breakout_no = substring (@breakout_no,1,@x)
print @breakout_no
set @prefix = (select prefix
from rate_plan
where prefix = @breakout_no and rate_plan_index = 1)
print 'prefix'
print @prefix
set @x = @x -1
end
select call_price
from rate_plan
where prefix = @prefix and rate_plan_index = 1
thanks a million