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

Explain different types of Normalization.

0 Answers   HPCL, Hughes Systique Corporation, Ittiam Systems,


How to maintain a fill factor in existing indexes?

0 Answers  


What is a cube? : sql server analysis services, ssas

0 Answers  


Can we return Data from 4(more than 1) tables in stored procedure?

0 Answers   HCL,


What is failover clustering overview?

0 Answers  






Tell me what do we need queues in sql service broker?

0 Answers  


What is the difference between a clustered index and a non-clustered index?

0 Answers  


What is the simplest way to create a new database in ms sql server?

0 Answers  


Explain try...catch with sql server?

0 Answers  


What are the advantages of partitioning?

0 Answers  


What is the purpose of floor function?

0 Answers  


What are the difference between primary keys and foreign keys?

0 Answers  


Categories