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 is merge statement?

629


What is the size of transaction log file?

489


What is Federation and Federation Member?

80


Can you always create a cache of a report?

115


Which joins are sql server default?

513






Mention the uses of stored procedures.

573


Please explain what is “asynchronous” communication in sql server service broker?

511


Explain view in sql server?

625


What is an expensive query?

540


What are the types of database recovery models?

601


what is the main function of a query parameter?

111


What is sql server 2000 work load governor?

556


Can the query output be sorted by multiple columns in ms sql server?

555


Your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files?

619


How do we Backup SQL Azure Data?

86