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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-07-01 : 07:31:30
|
| Stephanie submitted "I really need your help in creating a stored procedure that will allow me to insert data from one form into more than one table (namely 2 tables). I have never worked with stored procedures and I am little bit anxious about it. I am developing a web form using ASP/VBScript (though Dreamweaver MX) to create this form and I need the data from the form to go into two tables, 1)tblSamples and, 2) tblGSGSamples.Can someone steer me on the correct path?Thanks so much for your help.Stephanie Jones"" |
|
|
dsdeming
479 Posts |
Posted - 2003-07-01 : 08:12:58
|
| The one thing you want to make sure of in your stored procedure is proper use of a transaction. You want to be certain that you don't insert into one of the tables without inserting into another:BEGIN TRANSACTION MainINSERT INTO tblSamples( columnlist ) VALUES( your parameters )IF @@ERROR <> 0 ROLLBACK TRANSACTION MainINSERT INTO tblGSGSamples( columnlist ) VALUES( your parameters )IF @@ERROR <> 0 ROLLBACK TRANSACTION MainELSE COMMIT TRANSACTION MainDennis |
 |
|
|
|
|
|