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
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3275 Visits: 6497
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
SSC-Dedicated
SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)SSC-Dedicated (36K reputation)

Group: General Forum Members
Points: 36026 Visits: 11361
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 Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67403 Visits: 18570
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
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12597 Visits: 5010
Stewart "Arturius" Campbell (5/10/2012)
Interesting question, Wayne
Learned something new here.

+1 - foprced me to search MSDN.
Koen Verbeeck
Koen Verbeeck
SSC Guru
SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)SSC Guru (63K reputation)

Group: General Forum Members
Points: 63384 Visits: 13298
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
SSChampion
SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)SSChampion (10K reputation)

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

Igor Micev,
My blog: www.igormicev.com
Tom Thomson
Tom Thomson
One Orange Chip
One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)One Orange Chip (26K reputation)

Group: General Forum Members
Points: 26144 Visits: 12500
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
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

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

Thanks
Britt Cluff
Britt Cluff
SSCrazy
SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)SSCrazy (2.4K reputation)

Group: General Forum Members
Points: 2383 Visits: 253
Good question. Thanks for submitting.

http://brittcluff.blogspot.com/
Iulian -207023
Iulian -207023
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: 2489 Visits: 1248
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