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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:06:14+00:00 2026-05-18T12:06:14+00:00

I am trying to isolate an issue (that resembles the topic in stackoverflow.com/q/483787/537284). The

  • 0

I am trying to isolate an issue (that resembles the topic in stackoverflow.com/q/483787/537284). The issue involves a stored procedure and occurs “randomly” once a week. To try and reproduce the issue, I created different procedure versions to mimic good and bad possible outcomes:

  • Good multi-row single resultset.
  • Good multi-row single resultset with informational message.
  • Good multi-row single resultset with Raiserror (less than level 11).
  • Good multi-row single resultset with Print.
  • Good empty single resultset.
  • Bad syntax error.
  • Bad syntax error with try/catch.
  • Bad error with Raiserror (level 11).
  • Bad error with Raiserror (level 11) and try/catch.

Between these tests, the syntax error with try/catch version behaved differently than what I would expect. Two resultsets (one empty and the other from the catch instruction) come back.

Does the syntax error get partially executed? I expected the catch block’s result and not the try. I compared this with a Raiserror and using severity 11, it triggers the catch block with only one resultset returned. What is the difference between the syntax error and the Raiserror?

Here is my test procedure:

AS
BEGIN
    SET NOCOUNT ON
    SET ANSI_WARNINGS ON    
    SET IMPLICIT_TRANSACTIONS OFF 
    SET XACT_ABORT OFF 
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

BEGIN TRY
    --RAISERROR ('goes to message tab yes?', 11, 1) WITH NOWAIT
    SELECT '1' [myfield] FROM test_fulltext (nolock) WHERE CONTAINS(Command,'a monkey')
    RETURN 0
END TRY
BEGIN CATCH
    SELECT ERROR_NUMBER() [ErrorNumber]
END CATCH
RETURN -9999
END

Here is my test table (ripped from others):

CREATE TABLE test_fulltext 
( 
    SPID INT NOT NULL, 
    Status VARCHAR(32) NULL, 
    Login SYSNAME NULL, 
    HostName SYSNAME NULL, 
    BlkBy SYSNAME NULL, 
    DBName SYSNAME NULL, 
    Command VARCHAR(32) NULL, 
    CPUTime INT NULL, 
    DiskIO INT NULL, 
    LastBatch VARCHAR(14) NULL, 
    ProgramName VARCHAR(32) NULL, 
    SPID2 INT 
)
CREATE UNIQUE INDEX fulltextui ON test_fulltext(SPID);
CREATE FULLTEXT CATALOG fulltextft AS DEFAULT;
CREATE FULLTEXT INDEX ON test_fulltext(Command) KEY INDEX fulltextui;
  • 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-18T12:06:15+00:00Added an answer on May 18, 2026 at 12:06 pm

    Make sure to read the Remarks section fully on TRY…CATCH in Books Online. It explains this behavior in painful detail.

    What I don’t understand is this whole business about “forcing a syntax error”… If it’s in a stored procedure and you have a syntax error in it, the SP won’t even be created. Could it be that you’re actually executing an older version of the stored procedure?

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

Sidebar

Related Questions

I have simplified an issue that I've been having trying to isolate the problem,
Trying to find some simple SQL Server PIVOT examples. Most of the examples that
Trying to make a make generic select control that I can dynamically add elements
Trying to perform a single boolean NOT operation, it appears that under MS SQL
Trying to honor a feature request from our customers, I'd like that my application,
We're using SQLAlchemy declarative base and I have a method that I want isolate
I have a string that appears in my text files. I am trying to
I have a replica set that I am trying to upgrade the primary to
I am trying to develop a .NET 3.5 service application that uses: WCF for
I'm trying to parse a txt file that represents a grammar to be used

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.