In the below query i have performed the commit transaction statement but still the values after the save are not saved.
Can you please let me know why are the statements after save are rolled back even after commiting the data. help me with the understanding

declare @trans2 varchar(10)='transaction2'
begin transaction @trans2
insert into emp values(100,'xy',600);
save transaction @trans2
insert into emp values(200,'pq',700);
insert into emp values(300,'pq',800);
commit transaction @trans2
rollback tran @trans2

Answer Posted / vijayalakshmi

declare @trans2 varchar(10)='transaction2' 
 begin transaction @trans2 
 insert into emp values(100,'xy',600); 
 save transaction @trans2 
 insert into emp values(200,'pq',700); 
 insert into emp values(300,'pq',800); 
 save transaction @trans2 
 commit transaction @trans2 
 rollback tran @trans2

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens on checkpoint?

610


What is a primary key?

536


How can I add Reporting Services reports to my application?

91


what is the maximum size of a row? : Sql server database administration

531


Is truncate autocommit?

557






Explain different backup plans?

528


Explain what is the difference between a local and a global temporary table?

511


Can you explain what are various ways to enhance the ssrs report?

581


What is data source view or dsv? : sql server analysis services, ssas

553


Is there any difference between primary key and unique with the not null condition?

523


How many categories of functions based their return modes?

589


How many types of attribute relationships are there? : sql server analysis services, ssas

580


What is identity?

546


What is subquery explain with example?

609


How to create user messages with print statements in ms sql server?

588