![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Here's my problem: I want to write a stored procedure that returns all records from a table that have a certain column starting with given text. I however find that using LIKE and a variable always causes an index scan... which is causing performance issues. My table has about 3.5M records. Below is a test. In query analyser if I look at the execution plan for the following it will come up as in index scan. However, if i just hard-code the text it all works fine (index seek). How can I do this with reasonable speed??? Thanks Greg DECLARE @find varchar(50) SET @find = 'start' SELECT TOP 100 * FROM Test WHERE Col1 LIKE @find + '%' --Col1 LIKE 'start%' |
![]() |
| Thread Tools | |
| Display Modes | |
| |