I have a loop that goes through and updates records with a counter in it (business_counter). I filed name of 1business-Number, 2business_number, etc. I want to be able to call that column name by adding the business_counter+businessnumber. I have put ??? in the part of the code that I can't figure out the syntex for.
declare business_pointer Cursor for
Select CHRON_ID,BUSINESS_NUMBER
from a_business
open business_pointer
fetch next from business_pointer into @CHRONID,@BUSINESS_NUMBER
while @@fetch_status=0
begin
UPDATE r_pdf_confidential_build_detail
SET ???@business_counter+business_number=@business_number
where @business_number=@business_counter and @chronid=@chron
set @business_counter=@business_counter+1
fetch next from business_pointer into @CHRONID,@BUSINESS_NUMBER
end
close business_pointer
deallocate business_pointer
declare business_pointer Cursor for
Select CHRON_ID,BUSINESS_NUMBER
from a_business
open business_pointer
fetch next from business_pointer into @CHRONID,@BUSINESS_NUMBER
while @@fetch_status=0
begin
UPDATE r_pdf_confidential_build_detail
SET ???@business_counter+business_number=@business_number
where @business_number=@business_counter and @chronid=@chron
set @business_counter=@business_counter+1
fetch next from business_pointer into @CHRONID,@BUSINESS_NUMBER
end
close business_pointer
deallocate business_pointer