Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ALL


Author
Message
Site Owners
Site Owners
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: 10085 Visits: 1
Comments posted to this topic are about the item ALL
RBarryYoung
RBarryYoung
SSCrazy Eights
SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)

Group: General Forum Members
Points: 9438 Visits: 9517
Uh, steve, this "ALL" query is the same as the "ANY" query last week, but it now reports a different answer. NOTE that the word "ALL" does not appear anywhere in the question, a typo maybe?

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
Steve Jones
Steve Jones
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: Administrators
Points: 36070 Visits: 18736
Thanks, must have cut and pasted the wrong query in there.

Corrected to be all.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
RBarryYoung
RBarryYoung
SSCrazy Eights
SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)SSCrazy Eights (9.4K reputation)

Group: General Forum Members
Points: 9438 Visits: 9517
Heh, don't suppose I'm getting my two points, eh?

Never mind, I'll take them from these replies. Besides, I wouldn't want any more "enlightened" posters accusing me of point-mongering.

-- RBarryYoung, (302)375-0451 blog: MovingSQL.com, Twitter: @RBarryYoung
Proactive Performance Solutions, Inc.
"Performance is our middle name."
Hugo Kornelis
Hugo Kornelis
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: 8321 Visits: 11552
Nice question, Steve.

Too bad you didn't use the same case in the query and the list of values, as this might (*) result in different answers being returned when tested in a database with case-sensitive or binary collation.

(*) "might", as I didn't bother to check if it reallly would. Smile


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
pollockk
pollockk
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 24
Depends on whether the collation is case-sensitive or not. If it is the answer is 1...

--case sensitive
create table TimeGROUP(column1 varchar(255) COLLATE SQL_Latin1_General_Cp1_Cs_AS)

Insert into TimeGROUP (column1) values('value1')
Insert into TimeGROUP (column1) values('value2')
Insert into TimeGROUP (column1) values('value3')
Insert into TimeGROUP (column1) values('value4')


if 'Value1' < all ( select column1 from TimeGROUP ) select 1 else select 0

drop table TimeGROUP

--case insensitive
create table TimeGROUP(column1 varchar(255) COLLATE SQL_Latin1_General_Cp1_CI_AS)

Insert into TimeGROUP (column1) values('value1')
Insert into TimeGROUP (column1) values('value2')
Insert into TimeGROUP (column1) values('value3')
Insert into TimeGROUP (column1) values('value4')


if 'Value1' < all ( select column1 from TimeGROUP ) select 1 else select 0

drop table TimeGROUP
thierry.vandurme
thierry.vandurme
SSC Eights!
SSC Eights! (838 reputation)SSC Eights! (838 reputation)SSC Eights! (838 reputation)SSC Eights! (838 reputation)SSC Eights! (838 reputation)SSC Eights! (838 reputation)SSC Eights! (838 reputation)SSC Eights! (838 reputation)

Group: General Forum Members
Points: 838 Visits: 513
aggree with the collation thingie
also, the question mentions all lowercase strings while in the answer you mention VALUE1, which is all uppercase...
confusing, that's what I think...
brewmanz
brewmanz
SSC-Addicted
SSC-Addicted (489 reputation)SSC-Addicted (489 reputation)SSC-Addicted (489 reputation)SSC-Addicted (489 reputation)SSC-Addicted (489 reputation)SSC-Addicted (489 reputation)SSC-Addicted (489 reputation)SSC-Addicted (489 reputation)

Group: General Forum Members
Points: 489 Visits: 406
pollockk (6/30/2008)
Depends on whether the collation is case-sensitive or not. If it is the answer is 1...

That's what I thought too, But the Q poser knew that, and knew that I knew that, and I knew that they knew that ... giving an answer alternating between 0 and 1 depending on when you stop.
*BUT*
The poser, by not giving an option of "it depends", or "Invalid object name 'TimeGROUP'" gives the game away .. because ..
** HERE BE SPOILERS **
The table is called 'TimeGroup' but the query is 'TimeGROUP'
If the DB was case-sensitive, then the query would NOT find the table, unless there was ANOTHER table TimeGROUP - and the result of the query was *indeterminate* - not an option - so ...
The DB must be Case-Insensitive !!
QED - kind of
Hugo Kornelis
Hugo Kornelis
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: 8321 Visits: 11552
brewmanz (6/30/2008)
The table is called 'TimeGroup' but the query is 'TimeGROUP'
If the DB was case-sensitive, then the query would NOT find the table, unless there was ANOTHER table TimeGROUP - and the result of the query was *indeterminate* - not an option - so ...
The DB must be Case-Insensitive !!
QED - kind of


<nitpicking>
Except that it is perfectly possible to define a table with a case sensitive collation in a database with a case insensitive default collation...
</nitpicking>

However, I had no doubt whatsoever after reading the question that it was written without case sensitive collations in mind. The title of the question was "ALL", so it was clear that the author wanted to test understanding of this keyword, not ability to test some code by running it and then complaining if collations didn't match. I dare to state that anyone who really knows and understands the "ANY" keyword, should be able to answer this question correctly.

(Edit - fixed the fake HTML tags)


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
pollockk
pollockk
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 24
Of course these questions aren't about just running the SQL :-)

The question's main intent is clear, it's a pretty simple question about ALL - and I am not at all trying to be nitpicky or garner extra points or anything - it was just that in trying to work it out *in my head *, I noticed the case, noticed that it could affect the comparison, noticed that there wasn't enough info to deduce the whether the comparison would be case-sensitive or not - and thought that that might be an interesting *addendum/comment* to the main point.

Maybe that's just because I have been caught by tables with case sensitive collations in real life.

Kirsty


EDIT: typo + reword for clarity of intent.
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