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 |
|
Mageshkumar
Starting Member
29 Posts |
Posted - 2008-08-07 : 00:51:53
|
| Hi how to add 6 tables at a time using stored procedure...,See i have 6 tabels like,Emp_master,Emp_Work,Emp_Personal,Emp_Exp,Emp_Edu,Emp_Dep...,When the first table Master Getting values,in that identity seed ID column will get id,The same ID column will come other 5 tables also...,Between any of the table insertion will failure it have to Roll_Back values on previous table insertion values also...,I know its possible to using triggers,But i like to use stored procedure on here...,Guide me plz |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-07 : 02:37:50
|
| The identity generated can be obtained by using SCOPE_IDENTITY. then take value in a variable and use it for next insertion. Also wrap the entire code in a transaction and use TRY CATCH for rollback in case of any intermediate failure. |
 |
|
|
|
|
|
|
|