If i have one transaction say mainTransaction, within this
mainTransaction i have another two transaction say t1 and t2.
Now while execution t1 completes successfully and commit
statement fires, but while executing t2 some error occurs
and rollback statement fires.
What happen to t1, is it rollback or not?

Answer Posted / candorz

BEGIN TRANSACTION
GO
BEGIN TRANSACTION
INSERT INTO [JSSKDB].[dbo].[JobsDb_Countries]
([CountryName])
VALUES
('something')
GO
COMMIT
GO
BEGIN TRANSACTION
INSERT INTO [JSSKDB].[dbo].[JobsDb_Countries]
([CountryName])
VALUES
('something1')
ROLLBACK
GO


For the above transaction the rollback will undo any changes made by the previous sub-transaction i.e. no change will be seen in the DB

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Suppose you want to implement the one-to-one relationships while designing tables. How would you do it?

538


What is database replication? What are the different types of replication you can set up in sql server?

492


Can you please explain the difference between function and stored procedure?

536


Can two tables have the same primary key?

555


How to access the inserted record of an event?

566






When would you use the stored procedures or functions?

567


Explain differences between web edition and business edition?

103


Tell me what do you understand by a view? What does the with check option clause for a view do?

632


Explain the various types of concurrency problem?

688


Why use “nolock” in sql server?

552


What is merge join?

567


What is cdc in sql server?

563


What is 1nf normalization form?

585


What is Service Broker in sql server 2012?

614


How you can minimize the deadlock situation?

546