Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Major problem with indexing
Message
 
À
30/09/2008 12:07:55
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01351824
Message ID:
01351837
Vues:
17
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform