This is a discussion on question about like within the SQL Server forums, part of the Microsoft SQL Server category; --> I have a table that looks like this tbl1: nvchValue nvarchar(100) NOT NULL biVal1 bigint NOT NULL biVal2 bigint ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have a table that looks like this tbl1: nvchValue nvarchar(100) NOT NULL biVal1 bigint NOT NULL biVal2 bigint NOT NULL If I run this query against it: SELECT nvchValue FROM tbl1 WHERE nvchValue LIKE '%<%' I get a result set that doesn't make any sense to me: Term ----- ? ? ? fr?it Those values are in the database, but I don't understand how the match is working. Any help would be appriciated. |
| ||||
| It has to do with the collation you are using. Just like an 'a' is considered equal to an 'A' in a collation that is not case sensitive, the '<' is apparently considered equal to some of your ? characters. If you explicitely mention Binary Collation in the WHERE clause, then you will only get exact matches. Gert-Jan alternative_to_what@yahoo.com wrote: > > I have a table that looks like this > > tbl1: > nvchValue nvarchar(100) NOT NULL > biVal1 bigint NOT NULL > biVal2 bigint NOT NULL > > If I run this query against it: > SELECT nvchValue > FROM tbl1 > WHERE nvchValue LIKE '%<%' > > I get a result set that doesn't make any sense to me: > Term > > ----- > ? > ? > ? > fr?it > > Those values are in the database, but I don't understand how the match > is working. Any help would be appriciated. |
| Thread Tools | |
| Display Modes | |
|
|