
Looping through a list and inserting into a table
Hi,
I've got two lists and I want to loop through them and insert their
values into a table. My first list, lstAgency_no is for the first
field, and consists of 10 agency numbers (700 through 709), and the
second list, lstFund_No is for the second field, and consists of a
list of four funds (not incremental in nature): 001, 005, 301, 1112.
I'm just having a hard time with the syntax as a relative newbie :)
What I basically wish to avoid doing is the following:
INSERT INTO myTable (agency_no, fund_no) VALUES (700, 001)
INSERT INTO myTable (agency_no, fund_no) VALUES (700, 005)
INSERT INTO myTable (agency_no, fund_no) VALUES (700, 301)
INSERT INTO myTable (agency_no, fund_no) VALUES (700, 1112)
...
...
...
INSERT INTO myTable (agency_no, fund_no) VALUES (709, 001)
INSERT INTO myTable (agency_no, fund_no) VALUES (709, 005)
INSERT INTO myTable (agency_no, fund_no) VALUES (709, 301)
INSERT INTO myTable (agency_no, fund_no) VALUES (709, 1112)
Any help is greatly appreciated!
Sincerely,
Andrew