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

  • Home
  • SEARCH
  • 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 6621579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:17:03+00:00 2026-05-25T21:17:03+00:00

Considering the following example Procedure1 ………. IF(@errorcode<>0) ROLLBACK TRANSACTION ELSE COMMIT TRANSACTION SELECT @errorcode

  • 0

Considering the following example

Procedure1
..........
IF(@errorcode<>0) ROLLBACK TRANSACTION
ELSE COMMIT TRANSACTION
SELECT @errorcode

Procedure2
..........
WHILE [condition] BEGIN
   EXEC @proc1result = Procedure1 [parameters]
   IF(@proc1result=0) SET @totalresult=@totalresult+1
END
SELECT @totalresult

The problem is that @totalresult is incremented correctly but the value returned by Procedure2 is 0.
How to get it right?

I am using sql server 2008 and Entity Framework 4.
Procedure1 works well.

  • 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-25T21:17:04+00:00Added an answer on May 25, 2026 at 9:17 pm

    (1) For the first stored procedure, you should use RETURN @errorcode and not SELECT @errorcode. This is also my recommendation.

    OR (NOT AND)

    (2) For the second stored procedure, you should use INSERT ... EXEC Procedure1 like this:

    WHILE [condition] 
    BEGIN
       DECLARE @Results TABLE (RetValue INT PRIMARY KEY);
    
       INSERT @Results
       EXEC Procedure1 [parameters];
    
       --IF 0=ALL(SELECT a.RetValue FROM @Results a)
       IF NOT EXISTS(SELECT * FROM @Results a WHERE a.RetValue <> 0)
          SET @totalresult=@totalresult+1;
    
    END
    SELECT @totalresult
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Considering the following data example : data ={ {a, b, c, d, e}, {1,
Considering the following javascript example: var myobj = { func1: function() { alert(name in
Considering the following example, the line int a = objT + 5; gives ambiguous
Say I have a text file of 1 MB. Considering the following the example:
Considering following code public class A { public static void main(String[] args) { new
Considering the following architecture: a base object 'Entity' a derived object 'Entry:Base' and a
Considering the following table: someId INTEGER #PK ageStart TINYINT(3) ageEnd TINYINT(3) dateBegin INTEGER dateEnd
considering the following enum: public enum LeadStatus { Cold = 1, Warm = 2,
I'm considering the following: I have some data stream which I'd like to protect
I'll illustrate what I would like to get in the following example: '2010-09-01 03:00:00'

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.