April 21, 2011 at 9:23 am
I can't understand why every time I run a query in SSMS and I look at the bottom right to see the number of rows returned, it is always one more than what was actually returned. Once I click in the results pane, the rows count decrements by one to the actual row count. Is there something I'm not doing correctly here? Thanks for any help.
Jast as soon as I post, I see why the behaviour. IWhen I execute the sproc, SSMS is adding SELECT 'Return Value' = @return_value to the query window and that is the extra row count. If I comment the return line out it returns the correct row count. Is there a way to change my options so it doesn't add the SELECT 'Return Value' ...
Thanks
April 21, 2011 at 9:52 am
It would help to see code, but the result count in the lower status bar is the sum of all results. If you had a couple of batches or statements running, you get the total. You click on one result set and you get just that count.
April 21, 2011 at 10:11 am
As I said, I see now what is happening, the SELECT 'Return Value' statement is returning the extra row count like you mentioned. I get this by right clicking on a sproc and selecting Execute. Maybe there is an option to not add the SELECT 'Return Value' by default. Thanks
USE [MyDataBase]
GO
DECLARE@return_value int
EXEC@return_value = [dbo].[spMySproc]
SELECT'Return Value' = @return_value
GO
April 21, 2011 at 10:23 am
mention your sp code
Regards,
Syed Jahanzaib Bin Hassan
MCTS | MCITP | OCA | OCP | OCE | SCJP | IBMCDBA
My Blog
Regards,
Syed Jahanzaib Bin Hassan
BSCS | MCTS | MCITP | OCA | OCP | OCE | SCJP | IBMCDBA
My Blog
www.aureus-salah.com
April 21, 2011 at 10:28 am
My sp code is irrelevant, it doesn't matter which sp I run, the same thing happens.
I am new to this forum, is there a way to mark this as closed or answered?
April 21, 2011 at 10:33 am
alan.fisher (4/21/2011)
My sp code is irrelevant, it doesn't matter which sp I run, the same thing happens.I am new to this forum, is there a way to mark this as closed or answered?
You just did!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply