Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQLServerCentral.com
»
SQLServerCentral.com Announcements
»
ALL
25 posts, Page 1 of 3
1
2
3
»
»»
ALL
Rate Topic
Display Mode
Topic Options
Author
Message
Site Owners
Site Owners
Posted Saturday, June 28, 2008 1:34 PM
SSChampion
Group: General Forum Members
Last Login: Friday, May 18, 2007 3:36 PM
Points: 10,040,
Visits: 1
Comments posted to this topic are about the item
ALL
Post #525535
RBarryYoung
RBarryYoung
Posted Saturday, June 28, 2008 7:14 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 11:17 AM
Points: 9,855,
Visits: 9,376
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."
Post #525560
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Sunday, June 29, 2008 10:31 AM
SSC-Dedicated
Group: Administrators
Last Login: Today @ 3:19 PM
Points: 31,526,
Visits: 13,863
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
Post #525629
RBarryYoung
RBarryYoung
Posted Sunday, June 29, 2008 10:50 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Wednesday, June 12, 2013 11:17 AM
Points: 9,855,
Visits: 9,376
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."
Post #525636
Hugo Kornelis
Hugo Kornelis
Posted Monday, June 30, 2008 1:41 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 5,293,
Visits: 7,229
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. :)
Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog:
http://sqlblog.com/blogs/hugo_kornelis
Post #525758
pollockk
pollockk
Posted Monday, June 30, 2008 2:59 AM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, July 31, 2008 2:42 AM
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
Post #525772
thierry.vandurme
thierry.vandurme
Posted Monday, June 30, 2008 4:21 AM
Mr or Mrs. 500
Group: General Forum Members
Last Login: Yesterday @ 8:50 AM
Points: 583,
Visits: 291
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...
Post #525787
brewmanz
brewmanz
Posted Monday, June 30, 2008 5:11 AM
SSC-Addicted
Group: General Forum Members
Last Login: Tuesday, December 04, 2012 11:16 AM
Points: 477,
Visits: 389
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
Post #525803
Hugo Kornelis
Hugo Kornelis
Posted Monday, June 30, 2008 5:21 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 2:32 PM
Points: 5,293,
Visits: 7,229
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
Post #525807
pollockk
pollockk
Posted Monday, June 30, 2008 5:32 AM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, July 31, 2008 2:42 AM
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.
Post #525810
« Prev Topic
|
Next Topic »
25 posts, Page 1 of 3
1
2
3
»
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.