By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,266 Members | 1,312 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,266 IT Pros & Developers. It's quick & easy.

Very weird bug with 'like' function

antonopn
P: 42
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_General_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!
Expand|Select|Wrap|Line Numbers
  1. select * from account where code like '54.00%'
While this returns correct values
Expand|Select|Wrap|Line Numbers
  1. 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
Expand|Select|Wrap|Line Numbers
  1. 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...
Feb 26 '09 #1
Share this Question
Share on Google+
1 Reply


nbiswas
100+
P: 149
select * from account where code like '%54.00%'
Nov 28 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.