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


Queries


Queries

Author
Message
Stuart Davies
Stuart Davies
SSCrazy Eights
SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)SSCrazy Eights (9.6K reputation)

Group: General Forum Members
Points: 9554 Visits: 4856
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.


Query Fundamentals

There isn't a single statement in the batch that does a request for data, hence no queries.

+1

-------------------------------Posting Data Etiquette - Jeff Moden Smart way to ask a questionThere 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
derek.colley
derek.colley
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3580 Visits: 603
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:
CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
So why complicate your code AND MAKE MY JOB HARDER??!Crazy

Want to get the best help? Click here http://www.sqlservercentral.com/articles/Best+Practices/61537/ (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.

seankyleprice
seankyleprice
SSC-Enthusiastic
SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)SSC-Enthusiastic (156 reputation)

Group: General Forum Members
Points: 156 Visits: 70
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.
Toreador
Toreador
SSCarpal Tunnel
SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)SSCarpal Tunnel (5K reputation)

Group: General Forum Members
Points: 4979 Visits: 8184
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
call.copse
call.copse
SSCertifiable
SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)SSCertifiable (7.4K reputation)

Group: General Forum Members
Points: 7395 Visits: 2085
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.


Query Fundamentals

There isn't a single statement in the batch that does a request for data, hence no queries.


QFT

Another +1 from me
Lokesh Vij
Lokesh Vij
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4742 Visits: 1599
Toreador (11/28/2012)
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


+1
Same was the case with me :-)

~ Lokesh Vij

Guidelines for quicker answers on T-SQL question
Guidelines for answers on Performance questions

Link to my Blog Post --> www.SQLPathy.com

Follow me @Twitter


Stewart "Arturius" Campbell
Stewart "Arturius" Campbell
One Orange Chip
One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)One Orange Chip (27K reputation)

Group: General Forum Members
Points: 27236 Visits: 7545
to be quite honest, i'm at a bit of a loss about what to make of this question.
I assumed the question meant statements and not queries, so traced it using profiler, for statement started.Unsure

____________________________________________
Space, the final frontier? not any more...
All limits henceforth are self-imposed.
“libera tute vulgaris ex”
DugyC
DugyC
SSCrazy
SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)SSCrazy (2K reputation)

Group: General Forum Members
Points: 2032 Visits: 779
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.


Query Fundamentals

There isn't a single statement in the batch that does a request for data, hence no queries.

+1


Toreador (11/28/2012)
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

+1

_____________________________________________________________________
"The difficult tasks we do immediately, the impossible takes a little longer"
kapil_kk
kapil_kk
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8299 Visits: 2777
every person should be awarded +1 points who opted 0

_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Carlo Romagnano
Carlo Romagnano
SSCrazy Eights
SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)SSCrazy Eights (10K reputation)

Group: General Forum Members
Points: 9961 Visits: 3465
The profiler shows Read 0
This is the most wrong and useless qotd in the history of ssc.
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