Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
venkath
Posting Yak Master
202 Posts |
Posted - 2009-01-09 : 09:40:45
|
Hi AllI have a query like following SELECT ename FROM emp WHERE ename LIKE '%A\_B%' ESCAPE '\' When I search the query with escape character, it takes forever to return 0 records.When I remove \ character and execute the query, It executes quickly.I checked the execution plan of the query. It is not showing any table scans or clusterd index scans.ENAME column has index on it.Can you please clarify me why the searches with escape characters are taking long time.Thank you all |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-09 : 09:43:50
|
See Full text indexing. |
 |
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2009-01-09 : 11:15:23
|
You need an extra backslash to escape the other backslash:SELECT ename FROM emp WHERE ename LIKE '%A\\_B%' ESCAPE '\' |
 |
|
venkath
Posting Yak Master
202 Posts |
Posted - 2009-01-09 : 12:02:15
|
Why do we need extra \ to ignore '_' as a wild card character.I believe single \ is enough.apart from full index, is'nt there any option to improve the performance.Thanks |
 |
|
|
|
|