开发者

Chracter codes in sql 'like' queries?

开发者 https://www.devze.com 2023-04-09 03:35 出处:网络
I h开发者_开发问答ave been putting some data I have into my database. One of the files was somehow corrupted or something - it randomly has the character with value 6, ACK, in various unexpected place

I h开发者_开发问答ave been putting some data I have into my database. One of the files was somehow corrupted or something - it randomly has the character with value 6, ACK, in various unexpected places in place of real letters. This is causing me various problems with duplications in my database and so on - for instance, one company has two entries in my database, one as Afh Engineering Ltd., the other as Afh Engineerin Ltd. (SO may clean that character - basically the 'g' is replaced with an ACK character.)

I want to do a query for all the companies in my database that have this problem. Something like:

select * from users where CompanyName like '%06%'

but obviously for the character with value '6' rather than the character representing the indo-arabic numeral '6'.

How do I do this?


SELECT * 
    FROM users
    WHERE CHARINDEX(CHAR(6), CompanyName) <> 0
0

精彩评论

暂无评论...
验证码 换一张
取 消