Very weird bug with 'like' function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • antonopn
    New Member
    • Mar 2008
    • 42

    Very weird bug with 'like' function

    Hello there,

    I have just faced a really weird problem with a query in SQL SERVER 2000.

    I had a database with collation SQL_Latin1_Gene ral_CP1_CI_AS and converted it in a new database with collation Greek_CI_AI.

    The conversion was absolutelly correct. Tables, views, sps, functions etc. where succesfully transfered into the new database. The new database is working fine, but I faced a problem with a "select-from-where-like" query.

    I have a table named account with a column name code (varchar(255)). some values are:
    '54.00'
    '54.00.01.000'
    '54.00.01.001'
    '54.00.01.002'
    etc.

    This query does not return any values!
    Code:
    select * from account where code like '54.00%'
    While this returns correct values
    Code:
    select * from account where code like '54.%'
    The problem is with zeros (they are not number but characters).
    The following query also returns correct values
    Code:
    select * from account where code = '54.00'
    Overall, the problem occurs only when 'like' statement and character '0' come together...

    I'm REALLY CONFUSED!!!

    If anyone has any ideas I would really like to listen to them...
  • nbiswas
    New Member
    • May 2009
    • 149

    #2
    select * from account where code like '%54.00%'

    Comment

    Working...