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


SELECT * usage


SELECT * usage

Author
Message
Jan Van der Eecken
Jan Van der Eecken
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2458 Visits: 6494
Yet another reason never to do a SELECT *.

Great question, Wayne! And although I found the reference that Koen supplied, I still got the answer wrong. Anyhow, I learned something. That alone is worth it.

And no, I didn't think that the question was badly worded.

--------------------------------------------------------------------------
A little knowledge is a dangerous thing (Alexander Pope)

In order for us to help you as efficiently as possible, please read this before posting (courtesy of Jeff Moden)
Paul White
Paul White
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16198 Visits: 11355
WayneS (5/10/2012)
I tried (and sent this QotD to several folks to get their opinions) to make this a good QotD without this controversy.

Oops! I did see your mail, Wayne, but I was away from home at the time, and it slipped through the net. Sorry Pinch



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
SQLRNNR
SQLRNNR
SSC-Dedicated
SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)SSC-Dedicated (33K reputation)

Group: General Forum Members
Points: 33116 Visits: 18560
Good question.



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Revenant
Revenant
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: 7435 Visits: 4865
Stewart "Arturius" Campbell (5/10/2012)
Interesting question, Wayne
Learned something new here.

+1 - foprced me to search MSDN.
Koen Verbeeck
Koen Verbeeck
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: 27863 Visits: 13268
sknox (5/10/2012)

Not a good excuse, but a very good reason. I remember reading somewhere that the best way to read multiple-choice questions is to skim the question, read the answers carefully, and then go back and read the question very carefully, with the answers in mind. This reinforces the context of the question, and focuses you on picking out bits that disqualify the wrong answers.

I have no idea if that's true, but it seems to work for me.


I use the technique in the Microsoft certification exams and it works pretty well :-D


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Igor Micev
Igor Micev
SSCertifiable
SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)SSCertifiable (6K reputation)

Group: General Forum Members
Points: 5956 Visits: 5084
Extra question!
I missed it, but I appreciate it much.
Learned something new.
Thanks
IgorMi

Igor Micev,
SQL Server developer at Seavus
My blog: www.igormicev.com
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: 14554 Visits: 12238
WayneS (5/10/2012)
So phase 2 of my learning is: how could I have done it better?

Wayne, the question itself is clear, it's the wording of the answer options that makes it a bit unclear.

In the question, you say
not return a column as an individual column in the result set
so the meaning of "return" is clearly qualified.

In four of the five options provided for the answer you use "return" unqualified, which risks that readers will forget the qualification; in the other option you don't use "return" at all, and I think this is best. The other answers could easily be changed to avoid using "return" as well:
First option: just the single word "Never" would do fine.
Second option: could read "When the table contains sparse columns for which no selected row contains a non-null value".
Third option: is ok as it stands.
Fourth option: could read "When the table contains sparse columns and a sparse column set and some of the sparse columns have non-null values in none of the rows selected".
Fifth option: could read "Whenever the table contains sparse columns and a sparse column set".

I think this would have been a good deal clearer, because when one looks at the answers and forgets the qualification of return in the question a different one appears to be correct - assuming that "a null sparse column" has the meaning of the phrase I used above about no no-nulls in that column in the selected rows. Without the repeated use of unqualified "return" pushing one towards the ordinary meaning of return there is no reaon to forget the qualification in the question.

Incidentally, I wouldn't worry too much about a couple of us saying it could be clearer; that can be said of many qa QotD and many an article too (inluding mine, for sure).

Tom

Hardy21
Hardy21
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1614 Visits: 1399
Great question. Learn something new today...

Thanks
Britt Cluff
Britt Cluff
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: 1803 Visits: 253
Good question. Thanks for submitting.

http://brittcluff.blogspot.com/
Iulian -207023
Iulian -207023
SSCommitted
SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)SSCommitted (1.5K reputation)

Group: General Forum Members
Points: 1507 Visits: 1245
that was nice, thank you

as per msdn :
Caution
Adding a column set changes the behavior of SELECT * queries. The query will return the column set as an XML column and not return the individual sparse columns. Schema designers and software developers must be careful not to break existing applications.


Iulian
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