Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Multiple inserts?

Author  Topic 

metser
Starting Member

27 Posts

Posted - 2005-06-22 : 10:55:38
Hello (again). I'd appreciate your help here...

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).

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-06-22 : 11:33:51
What are you developing your web pages with?

Sean Roussy

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.
Go to Top of Page

metser
Starting Member

27 Posts

Posted - 2005-06-22 : 11:44:46
Working with ASP (not .NET), and SQL Server 2000
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-06-22 : 13:30:09
Here you go. Let me know if you have any questions

http://weblogs.sqlteam.com/brettk/archive/2005/06/22/6310.aspx



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

metser
Starting Member

27 Posts

Posted - 2005-06-23 : 00:48:30
Great! Thanks Brett!
Go to Top of Page
   

- Advertisement -