SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Number of Rows


Number of Rows

Author
Message
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)

Group: General Forum Members
Points: 7861 Visits: 25280
Dave62 (1/18/2013)
L' Eomot Inversé (1/18/2013)
...

So either I am missing something, or there's been a change in behaviour between 2008+SP3 and 2008R2+SP3.


Try this:

1) Paste code into SSMS query analyzer

2) Click "Display Estimated Execution Plan" button

3) Click on the "Messages" tab after the estimated execution plan is displayed

4) See the message "1 row(s) affected"

Enjoy!


Been there done that ... the message tab is NOT, let me repeat, the message tab in NOT part of the estimated execution plan

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

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Dave62
Dave62
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3247 Visits: 2777
bitbucket-25253 (1/18/2013)
[quote]...
Been there done that ... the message tab is NOT, let me repeat, the message tab in NOT part of the estimated execution plan


I think the message tab is very much a part of the estimated execution plan. When you run the exact same commands 3 different ways, the message tab displays differently for each way. This would indicate that what is read in the message tab can vary depending on how the commands are run.

Take these 3 commands run against the AdventureWorks database for example.
Select COUNT(*) From Person.Contact;

Select COUNT(*) From HumanResources.Employee;

Select COUNT(*) From Production.Product;


1) If you just execute the code, you will see 3 messages that say 1 row(s) affected

2) If you only click the Display Estimated Execution Plan button, you will see only 1 message that says 1 row(s) affected

3) If you click the Include Actual Execution Plane button and Execute, you will see 6 messages that say 1 row(s) affected

Enjoy!
Mark D Powell
Mark D Powell
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1848 Visits: 463
FYI - running the posted statents using 10.50.4000 I got a response with only the message tab back with the message "Command(s) completed successfully"and 0 rows listed in the bottom right corner when connected against the MASTER database from SSMS on my desktop.
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)SSCertifiable (7.9K reputation)

Group: General Forum Members
Points: 7861 Visits: 25280
Dave62 (1/18/2013)
bitbucket-25253 (1/18/2013)
[quote]...
Been there done that ... the message tab is NOT, let me repeat, the message tab in NOT part of the estimated execution plan


I think the message tab is very much a part of the estimated execution plan. When you run the exact same commands 3 different ways, the message tab displays differently for each way. This would indicate that what is read in the message tab can vary depending on how the commands are run.

Take these 3 commands run against the AdventureWorks database for example.
Select COUNT(*) From Person.Contact;

Select COUNT(*) From HumanResources.Employee;

Select COUNT(*) From Production.Product;


1) If you just execute the code, you will see 3 messages that say 1 row(s) affected

2) If you only click the Display Estimated Execution Plan button, you will see only 1 message that says 1 row(s) affected

3) If you click the Include Actual Execution Plane button and Execute, you will see 6 messages that say 1 row(s) affected

Enjoy!


I guess the best we can do is agree to disagree and leave it at that...

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

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Dave62
Dave62
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3247 Visits: 2777
bitbucket-25253 (1/18/2013)
...
I guess the best we can do is agree to disagree and leave it at that...

I don't even agree with this statement because I gave a clear and repeatable example of how the message tab can very depending upon how the code is run.

You have not given any clear or repeatable code to support your position. I think opening your mind to the possibility that you are wrong is better than agreeing to disagree in this instance.

Learning can not occur without an open mind.

Enjoy!
Tom Thomson
Tom Thomson
SSChampion
SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)SSChampion (14K reputation)

Group: General Forum Members
Points: 14384 Visits: 12213
Dave62 (1/18/2013)
L' Eomot Inversé (1/18/2013)
...

So either I am missing something, or there's been a change in behaviour between 2008+SP3 and 2008R2+SP3.


Try this:

1) Paste code into SSMS query analyzer

2) Click "Display Estimated Execution Plan" button

3) Click on the "Messages" tab after the estimated execution plan is displayed

4) See the message "1 row(s) affected"

Enjoy!

Oh, I see, you didn't mean "how many rows are affected by the following code". Unfortunately that's what you asked. Neither were you asking about rows in an estimated execution plan - because of course you have no code in the question that attempts to select from an estimated execution plan - although that's what the question said it was asking about. Oh well, I suppose that if you are sufficiently careless to express your question that badly I should assume that the response quoted above was not a deliberate attempt to take the piss, to insult, to offend. Now that I know what your question was supposed to mean, I can provide the answer you think is correct. But if you want to know how many rows that code affects, which is what you asked, you have to run the code as well as asking for an estimated execution plan, and that will definitely NOT give you "1 rows affected", and it's reasonable for people to assume that what you asked was what you meant to ask - - and perhaps also to expect you to at least try not to appear to be deliberately offensive. (Your last response to bitbucket appears that way to me too.)

Tom

Dave62
Dave62
Hall of Fame
Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)Hall of Fame (3.2K reputation)

Group: General Forum Members
Points: 3247 Visits: 2777
L' Eomot Inversé (1/18/2013)
... But if you want to know how many rows that code affects, which is what you asked, you have to run the code as well as asking for an estimated execution plan, and that will definitely NOT give you "1 rows affected"...


This part of your rant is very confusing. You seem to be saying that I did not mention the execution plan in the question.

Here is the exact text. "How many row(s) are affected by the following code in the estimated execution plan?"

As you can see, the estimated execution plan is clearly stated. Also, the only place you will ever see the text describing rows affected is in the message tab. And, if you follow the steps I provided, you will definitely see the message 1 row(s) affected in the only place it ever appears... the message tab.

Sorry to appear defensive but reason would suggest that one would not need to defend if one was not offended. If people did not misread the question and draw erroneous conclusions or make statements without providing code to support their position as I have then maybe I would not have been offended.

I should just let it go. If people want to just come here to complain rather than to learn then that says more about them than me.

Enjoy!
Keld Laursen (SEGES)
Keld Laursen (SEGES)
Old Hand
Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)Old Hand (366 reputation)

Group: General Forum Members
Points: 366 Visits: 202
Dave62 (1/19/2013)
<snip>

Here is the exact text. "How many row(s) are affected by the following code in the estimated execution plan?"

As you can see, the estimated execution plan is clearly stated. Also, the only place you will ever see the text describing rows affected is in the message tab. And, if you follow the steps I provided, you will definitely see the message 1 row(s) affected in the only place it ever appears... the message tab.
<snip>
Enjoy!


And this is where you lost me.
You ask for the number of rows that are affected in the estimated exeution plan. The answer is 0.
You then proceed to tell about the one row that the estimated execution plan results in. But that is outside the scope of the estimated execution plan!

So I would concur with whomever has had the sense to ask about a reworded question, such as:
How many rows are affected when you display an estimated execution plan with only one batch?
As somebody told us, then this code:
--
go
--


will result in:
(1 row(s) affected)

(1 row(s) affected)


which would tell us more about rows affected by showing estimated execution plans.

Granted, having the question about number of queries in an execution plan in mind, I were also looking through the execution plan data and finding no rows affected. And the question clearly stated "in the" execution plan, so no reason to look above the scope of the execution plan.

With this in mind, let's all agree to disagree, and continue to all be friends, shall we?
(Bob Brown)
(Bob Brown)
SSC Eights!
SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)

Group: General Forum Members
Points: 885 Visits: 1145
Thanks for the great question.
venkat9.sql
venkat9.sql
SSC Veteran
SSC Veteran (282 reputation)SSC Veteran (282 reputation)SSC Veteran (282 reputation)SSC Veteran (282 reputation)SSC Veteran (282 reputation)SSC Veteran (282 reputation)SSC Veteran (282 reputation)SSC Veteran (282 reputation)

Group: General Forum Members
Points: 282 Visits: 260
I am a starter in sql server..
Can some one let me know why i dont get the 1 row(s) affected message as stated but simply
Command(s) completed successfully message..

___________________________________________________________________
If I can answer a question then anyone can answer it..trying to reverse the logic.. Hehe
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search