
November 13th, 2000, 03:11 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,575
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : Bill Bozeman (bill_bozeman@hotmail.com)</b></i><br />In order to update 2 tables at the same time, you need to do one of two things. You can just have<br />2 SQL calls, one that updates one table, and then one that updates the other table. That works <br />well if you only need to do this on this page, but you have other pages where you want to add <br />data to the first table but not the second. If you always want to add data to the second table when<br />added to the first table, then I would use a trigger (if the db supports this) and after you update your<br />first the trigger will fire and update the second.<br /><br />However, a bigger question might be the design of your database. There is rarely a need to double <br />up on the data and you shouldn't be adding the same data twice to two different tables. That is why<br />there is not inherant command in SQL to do this, because it does not follow the rules of normalization.<br /><br />Bill<br /><br /><br />------------<br />Richard at 11/11/2000 1:29:17 PM<br /><br />How can i update a table and at the same time add to another table.<br /><br />I used the code from this site:<br />http://www.aspfree.com/asp/startpage.asp?id=23<br /><br />This works well for me BUT i need to know how i can do this:<br /><br />when the data is sent to update the table how can i code it to also ADD this data to a table.<br /><br />There are 15 records that are updated, i need these 15 records to be ADDED to another table everytime the form is submitted.
|