Imagine the following scenario:
I am using SQL Server 2005. I have a transaction that is calling, among other SQL statements, a stored procedure that also has a tran
I've tried with begin tran and commit inside the stored procedure say usp_test.
Exec these sp with some other query as below
update x set name='xxx'
select * from x---contains 'xxx'
begin tran
update x set name='yyy'
select * from x---contains 'yyy'
exec usp_test
select * from x---contains 'zzz' inside the sp
rollback tran
While executing the above query name in x table must be 'xxx' its not 'zzz' since the first begin tran rollbacked even the sp tran commit.
So, first begin tran own the data changes.