November 27, 2012 at 9:15 pm
I was completely not able to get this question!
Could have been phrased better..
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
November 27, 2012 at 9:58 pm
I guessed 7 and got it wrong.
I've just created a test database to try this.
Including actual execution plan shows nothing...
displaying estimated execution plan shows 8 queries, however, these 2 are counted as 1:
SET QUOTED_IDENTIFIER ON; SET ARITHABORT ON;
And both BEGIN TRAN
and COMMIT
are counted as queries in their own right. I suppose that's fair.
Interestingly, if you move QUOTED_IDENTIFIER to be the last one, estimated query plan counts it and COMMIT together as one query. I tried that hoping to see it say 9 queries but not what I expected at all. Seems like yet another quirk of the estimated query plan to me rather than being anything useful regarding the nature of the commands.
I hope someone can elaborate on this.
November 27, 2012 at 11:26 pm
Not able to get the today's question :w00t:
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
November 28, 2012 at 12:16 am
The only correct answer is 0.
There are 8 statements in the estimated execution plan, but no queries.
From BOL:
A query is a request for data that is stored in SQL Server.
There isn't a single statement in the batch that does a request for data, hence no queries.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
November 28, 2012 at 12:19 am
I select 0 option but get it wrong... 😉
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
November 28, 2012 at 12:23 am
That was ...
... interesting:rolleyes:
November 28, 2012 at 12:29 am
And what shall we learn from that?
November 28, 2012 at 12:36 am
I agree with Koen. Those are statements. As the estimated execution plan doesn't know better it will divide this up into 8 parts. Why the quoted_identifier setting always will go with the next statement is beyond me, but is of no consequense for the answer.
As we have learned before, the estimated execution plan can lie to us, e.g. because of function calls. I would say that the actual execution plan is the only non-lying report of this query batch, and as stated previously, the actual number of queries against the engine is 0.
November 28, 2012 at 1:24 am
Koen Verbeeck (11/28/2012)
The only correct answer is 0.There are 8 statements in the estimated execution plan, but no queries.
From BOL:
A query is a request for data that is stored in SQL Server.
There isn't a single statement in the batch that does a request for data, hence no queries.
+1
-------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a question
There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
November 28, 2012 at 2:07 am
Sorry, no. 0 is the correct answer, as each element of this question is a statement, not a query.
As above, BOL defines a query as a request for data, not a request to set an environment variable.
Poor question today.
---
Note to developers:Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.
November 28, 2012 at 2:14 am
I second guessed that the question meant statements as opposed to queries as otherwise it made no sense at all. I also second guessed that it wouldn't be 9 as I'd assumed so I ran a trace. I've been unable to capture the SET QUOTED_IDENTIFIER statement in a trace using SQL:stmtcompleted event at all. This applies whether I set it on or off, as part of a transaction or out of it, as part of a bunch of set statements or on its own. Even though I can't capture the statement, running it does have the expected impact. It may not have much in the way of practical implication but there is something interesting going on with the SET QUOTED_IDENTIFIER statement which the question has highlighted.
November 28, 2012 at 2:20 am
I didn't understand the question at all, so guessed. Having read the explanation I was none the wiser.
So I tried it, and the execution plan was empty.
confused.com
November 28, 2012 at 2:24 am
Koen Verbeeck (11/28/2012)
The only correct answer is 0.There are 8 statements in the estimated execution plan, but no queries.
From BOL:
A query is a request for data that is stored in SQL Server.
There isn't a single statement in the batch that does a request for data, hence no queries.
QFT
Another +1 from me
Viewing 15 posts - 1 through 15 (of 60 total)
You must be logged in to reply to this topic. Login to reply