"severe error occured" error : pls help

  • I recieve a strange error from sql server ,

    Msg 0, Level 11, State 0, Line 0

    A severe error occurred on the current command. The results, if any, should be discarded.

    when we use a return statement in the stored procedure.

    Below the stored procedure:

    create procedure sp_test

    (

    @a as int

    )

    as

    begin

    begin try

    begin transaction

    declare @b-2 as int

    set @b-2 = 1

    if @a = @b-2

    begin

    select 'i am rolling back'

    rollback tran

    return 1

    end

    end try

    begin catch

    if @@trancount >1

    begin

    rollback tran

    end

    end catch

    end

    ----------------------------------------------------------------------------------------------------------

    when the stored procedure is executed in the below way,

    exec sp_test 1

    -----------------------------------------------------------------------------------------------------------

    But we get error, when we execute in the following way...

    can any one please help?

    begin tran

    exec sp_test 1

    rollback tran

    Kindest Regards,
    Paarthasarathy
    Microsoft Certified Technology Specialist
    http://paarthasarathyk.blogspot.com

  • sorry for the error.. error reproducible only on sql 2005.

    please excuse.

    Kindest Regards,
    Paarthasarathy
    Microsoft Certified Technology Specialist
    http://paarthasarathyk.blogspot.com

  • Appears to be a duplicate posting... refer to:

    http://www.sqlservercentral.com/Forums/Topic926416-338-1.aspx

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply