Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
hi all, I m having a stored procedure which returns two result sets based on the success or failure.Resut set for success contains :name,id,statusResult set for failure :error_id,error_desc,applI 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, status char (1) ) insert into @tmpEXEC @ret = sptest '100','King' select @ret select * from @tmpIf the procedure is success i m getting the value in the temp table.If it fails i m getting a error like "Insert Error: Column name or number of supplied values does not match table definition."Can some one pls help me to handle both the result sets.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-04-12 : 13:27:48
you might need an if else statement here as your resultset is differing in both cases . so it should be something like