I have a form on my Website, where a Reseller enters his details, PLUS a list of companies he works with (using a checkbox for each company). On the DB side, I have 3 tables: a RESELLERS table, a COMPANIES table and a RESELLERS_COMPANIES junction table (for the many to many relationship). Now, when the Reseller submits the form, I get a LIST of companies he works with (any number of companies between 1 and 20). I therefore need to "loop" this "list", and INSERT each one to the junction table in a new row (the tables holds the Reseller_ID and the Company_ID). How do I do this? can it be done with one stored procedure? (again - I do not know in advance how many companies the reseller will choose when filling out the form).
Please backup all of your databases including master, msdb and model on a regular basis. I am tired of telling people they are screwed. The job you save may be your own.
I am available for consulting work. Just email me though the forum.