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 ««12

Wildcard Expand / Collapse
Author
Message
Posted Tuesday, January 26, 2010 5:46 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:05 PM
Points: 5,472, Visits: 23,551
Removed

If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #854055
Posted Tuesday, January 26, 2010 10:20 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, December 11, 2013 7:12 AM
Points: 366, Visits: 455
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...
Post #854142
Posted Tuesday, January 26, 2010 10:50 PM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, January 11, 2013 12:41 PM
Points: 621, Visits: 297
Good Question ... had to revise all wildcard characters.



Bhavesh Patel

http://bhaveshgpatel.wordpress.com/
Post #854161
Posted Monday, February 01, 2010 7:15 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 6:35 AM
Points: 1,251, Visits: 1,596
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.
Post #857159
Posted Friday, February 05, 2010 3:39 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, April 18, 2014 3:10 AM
Points: 199, Visits: 500
Its good to learn something like this :)

Thanks
Post #860294
Posted Sunday, February 14, 2010 2:23 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Today @ 3:34 PM
Points: 8,295, Visits: 8,748
sknox (2/1/2010)
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.

Yes, I agree. Now if one of the answers offered had been [^J]im I wonder if anyone would haven fallen into the trap of giving an answer that would work with the given data but not in general - then the source data would have been a real red herring!
It was a good question and answer, anyway.


Tom
Post #865311
Posted Monday, March 15, 2010 9:32 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Friday, March 15, 2013 10:35 AM
Points: 594, Visits: 654
Thanks for asking one I know without having to think about :)

Peter Trast
Microsoft Certified ...(insert many literal strings here)
Microsoft Design Architect with Alexander Open Systems
Post #883515
Posted Tuesday, March 30, 2010 10:23 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 5:04 PM
Points: 11,168, Visits: 10,939
Nice easy one - thanks



Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #893022
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse