Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 481857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:02:14+00:00 2026-05-13T01:02:14+00:00

I want to call a SP from another SP. I know I can easily

  • 0

I want to call a SP from another SP. I know I can easily call it. But Problem is, if an error occurs in SP2 then I want to ROLLBACK SP1.

SP1
BEGIN Tran
[Some Code]
Call to SP2
[Some Code]

SP2
BEGIN TRAN
[Some Code]
[Error Comes]
ROLLBACK TRAN

This would rollback Tran in sp2 only. I want to RollBack SP1 as well, if an error occurs in sp2.

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:02:14+00:00Added an answer on May 13, 2026 at 1:02 am

    Seems people have issues with other information sites…

    The gist of it is that the parent procedure will through an exception when trying to perform a ROLLBACK as the child already has. The way around this is to have the parent check the @trancount before committing.

    http://forums.asp.net/t/1259708.aspx

    Create procedure [dbo].[parent]  as Begin Transaction Begin Try
        Exec Child End Try Begin Catch
        If @@Trancount > 0
            RollBack End Catch Commit 
    
    
    Create procedure [dbo].[Child]  as Begin Transaction Begin Try
        --Do inserts here End Try Begin Catch
        If @@Trancount > 0
            RollBack
        RAISERROR('Error Occured',16,1) End Catch Commit
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know how I can call a method from an object within
I have a stored procedure that I want to call from within another, and
i want to call a batch file from another batch file and also want
I have a Makefile from which I want to call another external bash script
I want to call a webservice from jQuery. How can I do that?
I built a (very simple) library, which I can call just fine from another
I have a scenario where I want to call one TFS build from another,
In my application I want to call service from Receiver. This is my NotificationReceiver.java
I want to initiate a call from my Twilio number to a customer and
I want to call stored procedure from a trigger, how to execute that stored

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.