How to remove invisible characters in t-sql?

后端 未结 7 945
天命终不由人
天命终不由人 2021-02-02 09:07

I tried

UPDATE TABLENAME SET COLUMNNAME = REPLACE(COLUMNNAME, \'\\t\', \'\')

But I don\'t know how to write the TAB in t-sql

7条回答
  •  终归单人心
    2021-02-02 09:43

    One of the comments I tried above was only reading the data and not actually updating the data, I had the best success with the following

    UPDATE Tbl
    SET Tbl.[ColumnName] = LTRIM(RTRIM(REPLACE(REPLACE(REPLACE(Tbl.[ColumnName], CHAR(9), ' '),CHAR(13), ' '),CHAR(10), ' ')))
    FROM [TableName] AS Tbl
    
    

    I know this is a old question hope this helps someone

提交回复
热议问题