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

what's the difference between a primary key and a unique key? : Sql server database administration

685


How do indexes help, types?

718


How to start and end transact-sql statements?

747


If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?

721


Explain sql server authentication modes?

786






What do you understand by a stored procedure?

783


Can you give me some DBCC command options?(Database consistency check) - DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC - To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.

2229


What is dirty page?

723


How many ways to create table-valued functions?

751


Can we use having clause without group by?

733


Do you know what is similarity and difference between truncate and delete in sql?

760


What is difference between temp table and cte?

718


What are the types of indexing?

822


What are subquery and its properties?

731


When I run the sql server 2000 setup, it just hangs. What do I do?

801