Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    Italy
    Posts
    3

    Unanswered: Null params returned when execute a remote stored procedure that uses RaisError

    Hi all,
    i have trouble executing a remote stored procedure located
    in a linked server. In this example i want to reproduce my
    situation so you can easily understand my problem:

    ServerA, DatabaseA: SQL Server 2000 sp2
    -----------------------------

    <sql>
    Create Procedure dbo.stp_Remote_Procedure
    (@Param1 int
    ,@ErrMsg varChar(512) Output) As

    Begin
    If @Param1 = 0
    Begin
    Set @ErrMsg = 'This is a custom error message'
    Goto EH
    End

    Return

    EH:
    RaisError(@ErrMsg,16,1)
    Return

    End
    </sql>

    ServerB: SQL Server 2000 sp2
    -----------------------------

    With Query Analizer connected to this server try to exec
    the remote stored procedure like this:

    <sql>
    Declare @RetValue smallint
    Declare @ErrMsg varChar(512)

    Exec @RetValue =
    ServerA.DatabaseA.dbo.stp_remote_procedure 0, @ErrMsg
    Output

    Select @RetValue, @ErrMsg
    </sql>

    Now, when I execute dbo.stp_Remote_Procedure locally, i
    get the @RetValue (Zero) And @ErrMsg ('This is a custom
    error message') values correctly while if i exec this
    trought a remote call (my example) i always get both NULL
    values.
    I'm italian, excuse me for my english.

    T.I.A.,
    John

  2. #2
    Join Date
    Dec 2002
    Location
    Italy
    Posts
    3
    Up!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •