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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 the LIKE operator

Author  Topic 

jeroena
Yak Posting Veteran

76 Posts

Posted - 2002-10-18 : 08:33:05
Urrr... just to be sure...

I have a sp that returns rows from a customer table. The select contains something like:

SELECT
somecoolcustomerstuff
WHERE
lastname LIKE @p_first_part_of_lastname

Is there a way to usefully index the colomn 'lastname' or isn't this a good idea at all? I don't know if it'll perform yet, but just in case....

Thnx.

Spike

ashok
Yak Posting Veteran

57 Posts

Posted - 2002-10-18 : 08:49:12
Just that a wildcard at the end of string :
LIKE 'abcd%'
will make use of an index on the lastname column
but a wildcard at the beginning will not :
LIKE '%abcd'

-ashok
http://www.unganisha.org
Go to Top of Page

jeroena
Yak Posting Veteran

76 Posts

Posted - 2002-10-18 : 08:52:43
Thnx. Sounds logical.

Spike.


Go to Top of Page
   

- Advertisement -