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?



If i have one transaction say mainTransaction, within this mainTransaction i have another two trans..

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

More SQL Server Interview Questions

Create Index myIndex On myTable(myColumn) What type of Index will get created after executing the above statement

3 Answers  


Can we create a clustered index on composite primary key.

3 Answers   IGT,


Explain what is the difference between union and union all?

0 Answers  


what's the difference between delete table and truncate table commands? : Sql server database administration

0 Answers  


what purpose does the model database serve? : Sql server database administration

0 Answers  






What are defaults? Is there a column to which a default can't be bound?

2 Answers   TCS,


Explain Different types of Projects?

1 Answers  


how you can get the list of largest tables in a database? : Sql server administration

0 Answers  


How to handle errors in Stored Procedures. I want to display a message to the user in the .aspx page that is calling a stored procedure in it's code behind. please help me.

2 Answers   247Customer,


How do you know if sql server is running on your local system?

0 Answers  


John exports information periodically from a microsoft sql server database to an oracle database what is the best way to do this?

0 Answers  


What is the name of the Database which IBM mainframe uses?

0 Answers   Wipro,


Categories