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.
Author |
Topic |
dbleh
Starting Member
3 Posts |
Posted - 2011-03-16 : 22:27:02
|
Hello,I have a website project I'm working on that has a database with Vehicles table, Options table, VehicleOptions table. Vehicle table has the VehicleID,OptionID and the Options table has OptionID and OptionsDescription, the VehicleOptions table has the VehicleID, OptionID and OptionDescription. How do I update the tables when a user selects options from the website ? They can choose many options or none at all. Thank you for any help you can give me on this. |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-03-17 : 08:04:47
|
With stored procedures that accept parameters and execute update statements. |
|
|
dbleh
Starting Member
3 Posts |
Posted - 2011-03-17 : 12:16:08
|
Can you show me an example? Not sure how to go about it. |
|
|
Jahanzaib
Posting Yak Master
115 Posts |
Posted - 2011-04-15 : 08:24:20
|
you should have a common id in all tables then update on the different tables with this ID and use Store procedure for thislike :If userid = 345 is selecting many options then update records with this id with optionsRegards,Syed Jahanzaib Bin HassanMCTS,MCITP,OCA,OCP,OCE,SCJP,IBMCDBA |
|
|
Swaynebell
Starting Member
8 Posts |
Posted - 2011-04-29 : 10:21:53
|
Hi,A small point, but you don't need Option Description in the intersection table VehicleOption, since it is (correctly) in the Options table.On the same note, remove OptionId from the Vehicles table.In addition to improving the design, these changes should simplify the code you need to achieve what you're asking. |
|
|
|
|
|
|
|