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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Multiple inserts?
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

metser
Starting Member

27 Posts

Posted - 06/22/2005 :  10:55:38  Show Profile  Reply with Quote
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

USA
483 Posts

Posted - 06/22/2005 :  11:33:51  Show Profile  Reply with Quote
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 - 06/22/2005 :  11:44:46  Show Profile  Reply with Quote
Working with ASP (not .NET), and SQL Server 2000
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 06/22/2005 :  13:30:09  Show Profile  Reply with Quote
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 - 06/23/2005 :  00:48:30  Show Profile  Reply with Quote
Great! Thanks Brett!
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000