Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adding varible to column name

Status
Not open for further replies.

jvande

MIS
Jun 6, 2001
115
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top