Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LIKE '%1' Not returning expected records
Message
De
12/07/2010 10:53:07
 
 
À
12/07/2010 10:45:43
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01472231
Message ID:
01472233
Vues:
52
>I have a query like this:
>
>
SELECT [PolicyNumber]
>	FROM [dbo].[Policies]	
>		WHERE ([PolicyNumber] LIKE '%1')
>
>this returns no records.
>
>If I change it to this:
>
>
SELECT [PolicyNumber]
>	FROM [dbo].[Policies]	
>		WHERE ([PolicyNumber] LIKE '%')
>
>then I get two records, one with PolicyNumber = '00001'
>
>Why doesn't my first query pull this record out?
>
>PolicyNumber is defined as nchar(10).

Answering my own question:

This is because it is nchar(10) there are spaces right padded that I need to take into account. Duh! :)
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform