Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

Wildcards Expand / Collapse
Author
Message
Posted Saturday, November 30, 2013 6:58 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 4:44 PM
Points: 8,286, Visits: 8,736
Steve Jones - SSC Editor (11/30/2013)
I still don't agree with you. I asked:

"which of the following wildcard characters"

To me that implies that [] is a wildcard set of characters. I think asked

"can match a single character"

Meaning, can I use one or more of the wildcards to match a single character.

Well, the natural answer to that is that you can't use [] to match any character. [a] can match something, [b] can, and [cde] can, and so on, but none of those were on your list; so presumably we have to rule out & and {} because they aren't sets of wildcards, so why don't we have to rule out [a] and [b] and [cde] and so on for the same reason? There seem to be several apparently good reasons to interpret your words as meaning something you didn't intend (and you certainly fooled me).

Most people understood. Perhaps we're all wrong, but I fail to see how the question isn't clear unless you are trying to read the letters without realizing the spirit.

I'm not saying that you and the people that understood you straight away are wrong, and I don't think Ray Herring was saying that either - in fact I think you are being silly when you interpret his post that way. However, think about some of the people who post on this site and clearly struggle with English; someone struggling with a foreign language will often take a literal meaning of the words even when it's immediately obvious to a native speaker that the words are not intended to have that precise meaning. What I want to say is that you perhaps ought to take more care not to make difficulties for people who already have a problem because English is foreign to them. I'm lucky, I don't have a problem, I don't struggle, but I still misunderstood because I took your words literally.


Tom
Post #1518674
Posted Sunday, December 01, 2013 3:42 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:49 PM
Points: 5,794, Visits: 8,007
L' Eomot Inversé (11/30/2013)
Well, the natural answer to that is that you can't use [] to match any character. [a] can match something, [b] can, and [cde] can, and so on, but none of those were on your list

But [a], [b], and [cde] are all wildcard patterns - a search pattern that combines wildcard characters and normal characters to define the set of strings that should match.

The question was not about wildcard patters (or, to stick to the official Microsoft terminology, "like patterns"). The question was about wildcard characters. Of which exactly four are described in Books Online: %, _, [], and [^]. See http://technet.microsoft.com/en-us/library/ms179859.aspx.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1518690
Posted Sunday, December 01, 2013 5:54 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 4:44 PM
Points: 8,286, Visits: 8,736
Hugo Kornelis (12/1/2013)

But [a], [b], and [cde] are all wildcard patterns - a search pattern that combines wildcard characters and normal characters to define the set of strings that should match.

The question was not about wildcard patters (or, to stick to the official Microsoft terminology, "like patterns"). The question was about wildcard characters. Of which exactly four are described in Books Online: %, _, [], and [^]. See http://technet.microsoft.com/en-us/library/ms179859.aspx.

So, [] is a character, and so is [^]? That's quite an amazing misuse of English! Neither one is a character. One of them consists of two characters, and the other consists of three characters. Is the whole text of Gibbon's "Decline and Fall of the Roman Empire" a character? After all, if a string (or pattern, fo that matter) of two characters is a character and so is a string of three characters, it's difficult to see why a string of tvery very many characters shouldn't also be a character as well!

If the question was not about patterns but about those "character"s, please tell me what you think the "character" [] matches, as opposed to what can be matched by a pattern which includes the two real characters that occur in that "character" as well as some other characters placed between them. I know very well that X LIKE '[]'returns false unless X is NULL (in which case it returns unknown when the settings are ANSI-conformant, and false otherwise), but apparently you believe something different.


Tom
Post #1518694
Posted Sunday, December 01, 2013 7:27 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:49 PM
Points: 5,794, Visits: 8,007
L' Eomot Inversé (12/1/2013)

So, [] is a character, and so is [^]? That's quite an amazing misuse of English!

This isn't an English exam, it's a question about SQL Server. And the SQL Server documentation dubs [] and [^] characters. Deal with it, or file a documentation bug.
By the way, this is not even unique. It is in fact quite common to document elements of wildcard-featurinig search patterns "characters", even if they consist of multiple characters. Check for instance this page I found with official documentation for regexp (regular expressions): http://www.regular-expressions.info/refcharacters.html.

If the question was not about patterns but about those "character"s, please tell me what you think the "character" [] matches

It matches exactly one of the literal characters that is placed between the opening and closing bracket. Next time I post a link, please follow it and read it instead of bothering me with embarassing questions.

as opposed to what can be matched by a pattern which includes the two real characters that occur in that "character" as well as some other characters placed between them.

Ah, so you DO know what is matched by using the [] character in the appropriate way in a LIKE pattern. Then why ask? If you are really too stubborn to admit that you were wrong, then just unsubscribe from the topic and move on.

I know very well that X LIKE '[]'returns false unless X is NULL (in which case it returns unknown when the settings are ANSI-conformant, and false otherwise), but apparently you believe something different.

Please don't tell me what I do or do not believe, and please stop trying to sneak the discussion back to patterns - they are not the issue of this question.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1518698
Posted Monday, December 02, 2013 11:25 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: 2 days ago @ 6:04 AM
Points: 3,517, Visits: 2,606
Very straightforward. Thanks for making life easy Steve.
Post #1519082
Posted Friday, December 20, 2013 2:51 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 7:07 AM
Points: 1,144, Visits: 298
Probably did I not understand this ENGLISH question but I have had a good answer!
Post #1524903
Posted Wednesday, March 26, 2014 7:06 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, April 10, 2014 3:36 PM
Points: 2,111, Visits: 122
Wow, the discussion here has been quite lively.
Post #1554929
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse