Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is a transaction implied
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Is a transaction implied
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01075733
Message ID:
01075733
Views:
62
I am inserting a record into a "header" table and several records into a "details" table within the same SP.
My question is quite simple. Is a transaction implied within a SP when inserting into multiple tables within the same SP?

Something like this:
CREATE Procedure sp_Preset AS
INSERT INTO Header (..) VALUES (...)
INSERT INTO Detail (..) VALUES (...)
INSERT INTO Detail (..) VALUES (...)
INSERT INTO Detail (..) VALUES (...)
What if the 2nd insert into the Detail table fails for whatever reason, will all the above inserts be rolled back automatically or do I have to wrap this all into a transaction?

Einar
Semper ubi sub ubi.
Next
Reply
Map
View

Click here to load this message in the networking platform