Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | jansenStarting Member
 
 
                                        5 Posts | 
                                            
                                            |  Posted - 2002-09-16 : 05:11:47 
 |  
                                            | Hello all!I have a problem with the result of the like operator!Try out ...:create table tblName(vchrName varchar(10) null)insert into tblName (vchrName) values ('ab')insert into tblName (vchrName) values ('aab')insert into tblName (vchrName) values ('aaab')select * from tblName where vchrName like 'a%'select * from tblName where vchrName like 'aa%'The first select I would expect all rows but it only gives me [ab]??Best regardsJansen |  |  
                                    | AndraaxAged Yak Warrior
 
 
                                    790 Posts | 
                                        
                                          |  Posted - 2002-09-16 : 06:31:43 
 |  
                                          | I get the expected results... All three rows when using 'a%'. Strange!? |  
                                          |  |  |  
                                    | jansenStarting Member
 
 
                                    5 Posts | 
                                        
                                          |  Posted - 2002-09-16 : 09:44:34 
 |  
                                          | Hello AndraaxI think we are looking at a possible bug report....My coallation on the vchrName column is: Danish_Norwegian, dictonary sort, Accent Sensitive.When I change it, it also works?!? - What collation is your vchrName column??By the way...I'm running SQL2K with SP2/Jansen |  
                                          |  |  |  
                                    | AndraaxAged Yak Warrior
 
 
                                    790 Posts | 
                                        
                                          |  Posted - 2002-09-19 : 06:56:09 
 |  
                                          | Mine is Swedish_Finnish, dictionary, accent sensitive. |  
                                          |  |  |  
                                    | rrbSQLTeam Poet Laureate
 
 
                                    1479 Posts | 
                                        
                                          |  Posted - 2002-12-02 : 00:55:11 
 |  
                                          | Use the binary sort collation: (case sensitive - hence - lower)select * from tblName where lower(vchrName) collate Danish_Norwegian_BIN like 'a%' select * from tblName where lower(vchrName) collate Danish_Norwegian_BIN like 'aa%' from BOL: quote:Cheers--I hope that when I die someone will say of me "That guy sure owed me a lot of money"Edited by - rrb on 12/02/2002  00:59:16Sorts and compares data in Microsoft® SQL Server™ tables based on the bit patterns defined for each character. Binary sort order is case-sensitive, that is lowercase precedes uppercase, and accent-sensitive. This is the fastest sorting order. If this option is not selected, SQL Server follows sorting and comparison rules as defined in dictionaries for the associated language or alphabet.
 
 |  
                                          |  |  |  
                                    | Arnold FribbleYak-finder General
 
 
                                    1961 Posts | 
                                        
                                          |  Posted - 2002-12-02 : 07:42:37 
 |  
                                          | It's because the Danish_Norwegian collation is (still) considering aa to be a separate letter from a. Of course, this is ambiguous so it doesn't work properly.  The strange thing is that aa <> å unless the comparison is accent-insensitive. SELECT 1WHERE  'aa' COLLATE Danish_Norwegian_CI_AS =  'å' COLLATE Danish_Norwegian_CI_AS-- returns nothingSELECT 1WHERE  'aa' COLLATE Danish_Norwegian_CI_AI =  'å' COLLATE Danish_Norwegian_CI_AI-- returns 1SELECT 1WHERE  'aa' COLLATE Danish_Norwegian_CI_AI =  'á' COLLATE Danish_Norwegian_CI_AI-- returns nothingSELECT 1WHERE  'å' COLLATE Danish_Norwegian_CI_AI =  'á' COLLATE Danish_Norwegian_CI_AI-- returns nothingEdited by - Arnold Fribble on 12/02/2002  07:43:06 |  
                                          |  |  |  
                                |  |  |  |