Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Major problem with indexing
Message
 
To
30/09/2008 12:07:55
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01351824
Message ID:
01351837
Views:
18
>I have a major problem with the indexing.
>
>The following would find the related records:
>
>
>DECLARE @Name char(20)
>DECLARE @Name2 char(20)
>DECLARE @ID integer
>set @Name = 'A301041%'
>set @Name2 = 'A301041%'
>set @ID = 1
>
>SELECT Client.Numero FROM Client WHERE (Client.Name LIKE @Name OR Client.Name2 LIKE @Name2) AND Client.ID=@ID
>
>
>But, the following would not find any record:
>
>
>DECLARE @Name char(20)
>DECLARE @Name2 char(20)
>DECLARE @ID integer
>set @Name = 'A30104%'
>set @Name2 = 'A30104%'
>set @ID = 1
>
>SELECT Client.Numero FROM Client WHERE (Client.Name LIKE @Name OR Client.Name2 LIKE @Name2) AND Client.ID=@ID
>
>
>Can anyone explain me why the second query doesn't return any record? This doesn't make any sense to me. It should have at least the same number of records as the query string entered is having a wider range. I have done a Rebuild all on the indexes. I have done it twice and this didn't change anything.

I can't test this right now (I install some SP here)
but what if you change declarations of the variables from CHAR() to VARCHAR()?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform