Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LIKE '%1' Not returning expected records
Message
From
12/07/2010 10:53:07
 
 
To
12/07/2010 10:45:43
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Miscellaneous
Thread ID:
01472231
Message ID:
01472233
Views:
51
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform