Chracter codes in sql 'like' queries?
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
精彩评论