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



In the below query i have performed the commit transaction statement but still the values after the ..

Answer / 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

More SQL Server Interview Questions

How to use “drop” keyword in sql server and give an example?

0 Answers  


how can you check the level of fragmentation on a table? : Sql server administration

0 Answers  


What are the advantages of using third-party tools?

0 Answers  


How can I tell if sql server is 32 or 64 bit?

0 Answers  


When cursors are useful?

0 Answers  






Explain the advantages of merge replication?

0 Answers  


Is candidate a key?

0 Answers  


Explain difference between control flow and data flow?

0 Answers  


How to receive returning result from a query?

0 Answers  


Diffrence between DTS vs SSIS

2 Answers   IBM, Infosys,


What is the difference between stored procedure and functions?

0 Answers   MCN Solutions,


What is difference between standardization and normalization?

0 Answers  


Categories