November 11, 2004 at 5:59 pm
I am trying to find other alternatives to LIKE '%word' search clause so I that I would not need to use wildcard.
Here is what I came up:
Select OriginatingID
FROM m
Where LEFT(OriginatingID, 4) = ANY (SELECT OrigID FROM tmpO)
tmpO table has 4 character strings that needs to be compared against last four character strings in m table. LEFT(OriginatingID, 4) should give a column of four character strings to comapre against. but it doesn;t work.... any ideas
November 11, 2004 at 8:06 pm
The alternative to
where field like '%word' is
where RIGHT(field,4) = 'word'
LEFT(field,4) gets the first four characters of field, not the final four.
Regards
Phil
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
November 12, 2004 at 12:51 am
Well, since both methods can't use an index anyway, don't expect good performance on larger tables. I'm not that much into Full-Text Searching, however it might be an idea to read about it in BOL.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
November 12, 2004 at 1:49 am
I've found that using string functions in WHERE clauses has a higher performance penalty than using LIKE with wildcards.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply