SQL Server Performance

result set help

Discussion in 'SQL Server 2005 General Developer Questions' started by prasath_s01, Apr 12, 2009.

  1. prasath_s01 New Member

    hi all,
    I m having a stored procedure which returns two result sets based on the success or failure.
    SP sucess result set: name, id ,error,desc
    SP failure result sret: error,desc
    I m using the following query to get the result of the stored procedure .It returns 0 for success and -1 for failure.
    declare @ret int
    DECLARE @tmp TABLE
    (
    name CHAR(70),
    id INT,
    error char(2),
    desc varchar(30)

    insert into @tmp
    EXEC @ret = sptest '100','King'

    select @ret

    select * from @tmp

    If the SP is success the four field gets inserted into the temp table since the column mathches.
    But in case of failure the sp result set has only error and desc which does not matchs with no of columns in the temp table...
    .I cant change the Sp,so i need to do some thing(not sure) in temp table to handle both failure nad success.
    Any help is welcome..Its very urgent .Killing my head.
    Thanks in advance
  2. satya Moderator

Share This Page