1
Answer

Use of SQL transactions in stored procedure

Ask a question
Hi Friends,
In my project two tables one is Head and another is Detail.
Head table columns are - HeadId,Name,Address
Detail table columns are - DetailId (primary key), description, rate, HeadId(foreign key)

Sometimes what happend,Record is inserted only in Head table but not inserted in Detail table.I want to use transaction in stored procedure for insert record in both tables at a time. and one more thing is I want to insert more than one record in Detail table and in Head table insert only one record.

e.g. Head - 101,ABC,XYZ
Detail - 1,aaa,10,101
2,bbb,20,101
3,ccc,30,101
please give me solution for this scenario

Answers (1)