May 28, 2003 at 3:08 am
Hi All,
I want to know for my clarity that does BEGIN TRAN works for the Dynamic SQL executed through EXEC and Sp_ExecuteSQL
secondly if i put a transaction on as SP
e.g.
BEGIN TRAN
EXEC sp_sample
IF @@Error <> 0
ROLLBACK TRAN
ELSE
COMMIT TRAN
will the transaction be aplied on code inside SP mean i some error occurs inside SP then it gets roll backed. according ot my understading transaction should work in both
cases as the code is bound inside the transaction.
Waiting for reply.
Regards,
Affan
May 28, 2003 at 4:01 am
Please do not cross post. As for the answer to your question, it should be. To be absolutely sure you get the desired results set up a test scenario in a copy of the database or similar setup with sample data and verify what you are doing does cause the desired effect. But I setup a test scenario with Dynamic SQL and the TRANSACTION occurred as expected.
May 28, 2003 at 5:08 am
Thanks Antares and sorry for the cross post as i thought different people are subscribed to different forums.
May 28, 2003 at 5:18 am
We all agree that most everyone uses the Active Threads link at the top right corner. Common mistake thou.
May 28, 2003 at 5:29 am
One more question related to index that
what are the best guidelines and practices for creating indexes.
Regards,
Affan
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply