fikir
Programmer
- Jun 25, 2007
- 86
I am a bit confused here with handling a transaction
I am trying to insert data into a series of production tables.
insert into tbl1 (col1, col2)
select colt, col2 from stagingTable1
--error handling
insert into tbl2 (col1, col2
select col1, col2 from stagingTable2
--error handling
.
.
.
I want to put this in a single transaction and if the process failes any where it should rollback every thing, It should rollback to the point before the load data process starts
how can I do this.
second thing is every tables have identity columns and I want to reset these identity columns of each tables to 1
after rolling back
How do I do this also
Thanks
I am trying to insert data into a series of production tables.
insert into tbl1 (col1, col2)
select colt, col2 from stagingTable1
--error handling
insert into tbl2 (col1, col2
select col1, col2 from stagingTable2
--error handling
.
.
.
I want to put this in a single transaction and if the process failes any where it should rollback every thing, It should rollback to the point before the load data process starts
how can I do this.
second thing is every tables have identity columns and I want to reset these identity columns of each tables to 1
after rolling back
How do I do this also
Thanks