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
 General SQL Server Forums
 New to SQL Server Programming
 problem with index

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-02-12 : 10:04:44
Zaki Ahsan writes "Dear Member

I am a new user of SQL server 2000 in a company who uses mases of data. We just came across a problem which is quite strange and we can not find any answers for it on the web.

We have a table which stores UK postcodes, this table has a clustered index on primary key which is ID and a non clustered index on postcode.

The problem comes in when we do search which has a 'z%' at the end. SQL server does not use index and rather do a scan.

for example

if i search for following it will use an index

N14 5JN%
E14 8BG%
n21 2au%

but when we replace the last character with z for example
N14 5JZ%

it starts doing table scan

do u have any clue why?"

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-02-12 : 10:30:13
you probably have some index fragmentation and proper range seeks aren't possible so it's using a scan.
try recreating and index or reindex the table.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -