SQL无法删除CHAR(13)

时间:2017-02-20 15:04:18

标签: sql-server replace carriage-return

我正在查看一个表格,其中输入了数据项,其中包含CHAR(13)。

我可以通过以下方式轻松识别行:

SELECT  *
FROM    Preferences
WHERE   PreferenceName LIKE '%' + CHAR(13) + '%'

所以从这里我知道了具有控制特征的线条。但是,当我尝试删除这些字符:

UPDATE  dbo.Preferences
SET     PreferenceName = REPLACE(PreferenceName, CHAR(13), '')
WHERE   PreferenceName LIKE '%' + CHAR(13) + '%'

我收到0行受影响的邮件,当然没有更新。我需要整理这些数据,因为它会影响过滤。 (我可以选择喜欢但不是等于当然慢很多的等等)

为什么这会像预期的那样成功?

1 个答案:

答案 0 :(得分:0)

我刚做了一次测试

   @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Display display = getWindowManager().getDefaultDisplay();
        Point size = new Point();
        display.getSize(size);
        int width = size.x;
        int height = size.y;

        if(//some code here to calculate what size the screen is lets say +4")
        {
            setContentView(R.layout.layout1);
        }
        else if(//another block for lets say 3.7")
        {
            setContentView(R.layout.layout2);                    
        }
    }
ID          s                                                  replaced
----------- -------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2           This is the sencode string
                        After replaced:This is the sencode string
4           This is
 a 
 string containing special character!
 After replaced:This is a  string containing special character!