|
|
|
UDP Broadcaster
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 11:30 AM
Points: 1,495,
Visits: 1,507
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 12:58 AM
Points: 1,169,
Visits: 1,244
|
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 8:50 AM
Points: 746,
Visits: 435
|
|
-- Dineshbabu Desire to learn new things..
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Yesterday @ 7:42 AM
Points: 975,
Visits: 517
|
|
I selected "0" and got wrong.
I think it is because 1 row in the system table is being affected and that is the reason the messages tab shows "(1 row(s) affected)". This happens when we click on estimated execution plan button by just having a "--" (commented line) in the query window.
Regards, Ravi.
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: 2 days ago @ 6:54 AM
Points: 9,364,
Visits: 6,462
|
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 8:50 AM
Points: 746,
Visits: 435
|
|
If we run the profiler before clicking Display Estimated Execution Plan, we can see SHOWPLAN_XML option is set to ON. I think due to enabling this set option we are getting as "1 row(s) affected".
Letz wait untill some experts to explain in detail..
-- Dineshbabu Desire to learn new things..
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: 2 days ago @ 1:32 AM
Points: 3,187,
Visits: 4,140
|
|
Dineshbabu (1/18/2013) If we run the profiler before clicking Display Estimated Execution Plan, we can see SHOWPLAN_XML option is set to ON. I think due to enabling this set option we are getting as "1 row(s) affected". Well... you were very close 
The "affected row" is the Estimated Execution Plan itself!
Try running
SET SHOWPLAN_XML ON GO <Whatever batch you want> GO SET SHOWPLAN_XML OFF GO and you'll get a result set with one column named "Microsoft SQL Server 2005 XML Showplan" and one row containing an execution plan. That row is displayed as "affected", and it doesn't matter what batch you estimate (it only must be a valid batch, otherwise you'll get a syntax error instead of any number of "affected rows").
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: 2 days ago @ 4:24 AM
Points: 1,158,
Visits: 642
|
|
In my naivete I'm thinking 'so what?'.
Is there a relevance to this?
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 6:46 PM
Points: 1,074,
Visits: 1,076
|
|
Lokesh Vij (1/17/2013)
I knew there was a discussion on similar question recently, still got the answer wrong  Whilst, I was trying to look at the queries executed in estimated execution plan, my eye caught something. What ever operation is performed after "SET QUOTED_IDENTIFIER ON;", it is treated as a single query along with QUOTED_IDENTIFIER. Would really appreciate if someone can pitch-in and explain. Thanks!
I remember the discussion ; but, I tested that to confirm it ; then I got counfused as it came no rows effected . So , I got it wrong well, I forgot the question while testing it - the Display Estimated plan .. I don't need coffee, I need less work...
Try executing any select query , it gives 1 rows affected.
~ demonfox ___________________________________________________________________ Wondering what I would do next , when I am done with this one
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 12:12 PM
Points: 5,231,
Visits: 7,021
|
|
paul s-306273 (1/18/2013) In my naivete I'm thinking 'so what?'.
Is there a relevance to this?
That's what I though as well when answering the question.
The question itself doesn't appear to make sense to me, but maybe that's because I am not a native English speaker? It mentions "rows affected in the estimated execution plan - but there are no rows in the estimated plan (it's XML).
I figured that the author meant "how many rows are affected by the following code when you request an estimated execution plan". But that is nonsense as well, because an estimated plan is made by compiling, but not running the code. So no rows can be affected by definition.
If you have SSMS set to return number of rows affected (yes, that is a changeable option!), then you will indeed get the message "1 row(s) affected". That is because a resultset of 1 row is returned from the server to SSMS. That result set contains the XML column holding the execution plan. You always get this "1 row(s) selected" message when requesting an estimated execution plan, it has nothing to do with the code you wrote. (Except when there are parse errors -in that case, you never get to the compilation stage- or multiple batches -in that case, you get one such message for each batch-)
But again - back to Paul Knibb's reaction: what is the relevance of this?
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|