答案 0 :(得分:3)
UNICODE建议对我不起作用 - 字符被视为问号,因此查询是查找带有问号的所有字符串,而不是带有问号的字符串。
Tom Cooper在此链接上发布的修复程序对我有用:https://social.msdn.microsoft.com/forums/sqlserver/en-US/2754165e-7ab7-44b0-abb4-3be487710f31/black-diamond-with-question-mark
-- Find rows with the character
Select * From [MyTable]
Where CharIndex(nchar(65533) COLLATE Latin1_General_BIN2, MyColumn) > 0
-- Update rows replacing character with a !
Update [MyTable]
set MyColumn = Replace(MyColumn, nchar(65533) COLLATE Latin1_General_BIN2, '!')
答案 1 :(得分:2)
使用Unicode功能:
DECLARE @TEST TABLE (ID INT, WORDS VARCHAR(10))
INSERT INTO @TEST VALUES (1, 'A�AA')
INSERT INTO @TEST VALUES (2, 'BBB')
INSERT INTO @TEST VALUES (3, 'CC�C')
INSERT INTO @TEST VALUES (4, 'DDD')
SELECT * FROM @TEST WHERE WORDS LIKE '%' + NCHAR(UNICODE('�')) + '%'
UPDATE @TEST
SET WORDS = REPLACE(WORDS, NCHAR(UNICODE('�')), 'X')
SELECT * FROM @TEST WHERE WORDS LIKE '%' + NCHAR(UNICODE('�')) + '%'
SELECT * FROM @TEST
答案 2 :(得分:0)
尝试使用以下代码在查询中搜索您要查找的字符。
select field_name from tbl_name where instr(field_name, 'charToBeSearched') > 0;
此查询将查找并选择具有替换字符的记录。