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 3785626
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:33:26+00:00 2026-05-19T11:33:26+00:00

I have a stored proc with a structure similar to the following BEGIN TRY

  • 0

I have a stored proc with a structure similar to the following

BEGIN TRY
BEGIN TRANSACTION

    IF EXISTS (SELECT Something FROM Somewhere WHERE Something = '123abc')
        GOTO FINISHED

    IF NOT EXISTS (SELECT Something FROM Somewhere WHERE Something = 'abc123')
        SET @ReturnCode = 2

    FINISHED:

    COMMIT TRANSACTION

END TRY
BEGIN CATCH

    ROLLBACK TRANSACTION

END CATCH

Assume the GOTO isn’t being used. I’m getting the following two errors

Line 183
Incorrect syntax near 'F'.
Line 183
Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 2.

If I wrap the last IF with a BEGIN and END the stored proc works as normal. This is fine and takes care of my syntax issues.

The problem is I have this exact stored proc on two different servers. One will always get the errors and one never gets the errors with the code as it is above.

The only thing I can think of is that there may be some setting in SQL that is turned on on one server but not the other. Has anyone ever had something like this happen before?

More details: The problematic server is out of date with no service packs installed while the second server has SP2 installed. Currently in the process of upgrading. Will update later with results.

  • 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-19T11:33:27+00:00Added an answer on May 19, 2026 at 11:33 am

    So, as per my last edit, I installed service pack 3. This resolved the issue I was experiencing.

    Apparently this was resolved in SP2. See the following links

    Link to KB article for SP2 bug fixes

    Link to specific bug

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored proc and I am trying to select all rows from
I have a Stored proc which returns 6 select statement results. I'm trying to
I have a stored proc, SP1, which executes and does select on one table.
I have a stored proc, with joins like so: FROM Salesforce_Pervasive.dbo.Account a INNER JOIN
I have a stored proc which inserts rows from a view with ranks into
I have a stored proc that performs a fairly complex SELECT statement. The stored
We have a stored proc that grabs that data from a table, let's call
I have a stored proc which returns a result set with somewhere around 20
I have a stored proc select statement that lookes like that: SELECT p.ID AS
We currently have a stored proc that needs to do the following: If Query1

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.