January 26, 2010 at 1:22 am
Never seen this wildcard till now, thanks for the tip, was worth getting it wrong
Glen Parker 🙂
January 26, 2010 at 6:18 am
I too had to guess. Got it right only because I new the others were wrong. Never saw this wild card before, and look forward to using it.
Thanks for the QOD
Steve Jimmo
Sr DBA
“If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan
January 26, 2010 at 6:35 am
That's what I get for answering before having my coffee. :doze:
I picked '%im' because of course % is a wildcard. But it will return more than just Kim or Tim.
Nice question.
Dave
January 26, 2010 at 7:34 am
DOH missed Jim at the top...
-------------------------------------------------------------------------
Normal chaos will be resumed as soon as possible. :crazy:
January 26, 2010 at 7:38 am
Thanks for the question! I did not know you could do that (but apparently I am in the minority). :hehe:
January 26, 2010 at 8:14 am
Good one. Always used '%' as wild card.
SQL DBA.
January 26, 2010 at 9:19 am
January 26, 2010 at 12:37 pm
John McC (1/26/2010)
DOH missed Jim at the top...
I nearly did the same thing - had to reread the list of names. If you see Jim at the top, I think the question becomes a lot easier.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 26, 2010 at 12:38 pm
Thanks for the question and the reminder on this type of pattern matching.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
January 26, 2010 at 5:46 pm
January 26, 2010 at 10:20 pm
Gr8 QotD, Thanks...I got it correct...but it was just a calculated guess...as other options were incorrect...
look fwd to use this wildcard...
January 26, 2010 at 10:50 pm
Good Question ... had to revise all wildcard characters. 😀
February 1, 2010 at 7:15 am
To be strict, the source data was a red herring. A where clause shouldn't be based on the data you have, but the data you want.
In this case, for example, it doesn't matter that "Jim" exists in the source data (or "Tim" or "Kim" or "Bim" for that matter). What matters is that you want to retrieve only rows with "Tim" or "Kim".
If you used "Like '%im'", and "Jim" wasn't in the source data, your query would work. Once. But it would break as soon as someone added any other name like '%im'. If you get in the habit of using shortcuts rather than framing your query properly, you'll be rewriting queries more and more often.
Trust me, I know.
February 5, 2010 at 3:40 am
Its good to learn something like this 🙂
Thanks
Viewing 15 posts - 1 through 15 (of 17 total)
You must be logged in to reply to this topic. Login to reply