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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Collation problem with "like"

Author  Topic 

kpk
Starting Member

2 Posts

Posted - 2006-07-18 : 06:44:58
I had to change my database collation , from "Sql_Latin1_General_CP1253_greek_CI_AS" to "Sql_Latin1_General_CP1253_greek_CI_AI".
I have a problem with "like" statements. When I have zeros ("0") in varchar columns and the zeros are in the end of the value (like "120000") a like statement as "like '120%'" has no results.
If the value is "120100" then this statement "like '120%'" results the line as well.
Any clue?

Thanks a lot

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-18 : 07:14:42
try
col like '120%' collate Sql_Latin1_General_CP1253_greek_CI_AS
and
col like '120%' collate Sql_Latin1_General_CP1253_greek_CI_AI

The column probably has the old collation unles you have changed it and the like will be using the new.
Bit surprised you don't get a collation incompatibility error.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

kpk
Starting Member

2 Posts

Posted - 2006-07-18 : 09:35:49
Columns have the same collation.
I can't use statements like this "'120%' collate Sql_Latin1_General_CP1253_greek_CI_AS" because I have to rewrite all my sources.
The only problem I have is the zero in the end of a varchar value , with "%" in the like statement
Go to Top of Page
   

- Advertisement -