>>>>Hi Naomi,
>>>>
>>>>I removed the last two lines from the WHERE clause and ran it again and I don't get any results returned.
>>>
>>>It means that your field is saved with some extra characters. Get this row using +% and then examine that field's content - it can have some extra characters saved you don't see.
>>
>>I don't follow your logic. :(
>>
>>This is being done in SSMS where I have "hardcoded" the value 'WLIF20120047' as the value of the parameter like this:
>>
>>declare @PolicyNumber nvarchar(20)
>>set @PolicyNumber = 'WLIF20120047'
>>
>>so it is impossible to have other characters in there, isn't it?
>
>I mean that the field has other invisible characters, otherwise that row have been found. Get that row, copy the field content and then examine it in the Hex Editor.
>
>Here is a simple test that shows that even spaces saved in the field matter:
>
>DECLARE @Test TABLE (Fld1 nvarCHAR(50))
>INSERT INTO @Test VALUES ('WLIF20120047 ')
>insert into @test values('WLIF20120047' + replicate(char(9),4))
>
>declare @PolicyNumber nvarchar(20)
>set @PolicyNumber = 'WLIF20120047'
>
>SELECT * FROM @Test WHERE Fld1 LIKE @PolicyNumber
>SELECT * FROM @Test WHERE Fld1 = @PolicyNumber
>
>
>In other words, seems like LIKE comparison doesn't work when there are some extra characters in the field even spaces. = ignores spaces.
Ah, got you now. You are right, it has blank characters at the end of it. I will see how this is getting into the field and fix it. Thanks.