sql server 2008 - rollback did not happen with save transaction -


i have 3 questions.

first can tell me why rollback of save transaction did not happen. had entered error 1/0 after delete #t2 in second block of try..catch statement.

second if example procedure t1 calls procedure t2 , there error in t2 procedure outer transaction rolled in case use xact_abort off.can commit transaction.

my third question possible commit save transaction , not entire transaction.

if exists(select * tempdb.information_schema.tables table_name    '%#t1%') begin     drop table #t1     drop table #t2     drop table #t3     drop table #t4     drop table #t5 end  create table #t1(c int); create table #t2(c int); create table #t3(c int); create table #t4(c int); create table #t5(c int);  insert #t1 select 1; insert #t2 select 1; insert #t3 select 1; insert #t4 select 1; insert #t5 select 1; begin transaction  begin try delete #t1     --step 1 end try  begin catch rollback transaction end catch  if @@error = 0  begin save transaction t1 end  begin try delete #t2      ---step 2 select 1/0 end try  begin catch rollback transaction t1 commit transaction end catch 

i figure out reason why rollback t1 transaction looked not happening that's because saving transaction after deleting table #t1 , showing null values.its working fine without save transaction. thanks


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -