Search code examples
sqlsql-servert-sqlcontrol-characters

Replacing weird control characters from sql server table


I have a sql server table where control characters appear when column is copied and pasted into notepad. I need to remove/replace these control characters. For example here is a text i copied from my sql server table into notepad

enter image description here

How do i remove "OSC". I have searched the net and here but cant find anything on this. Table was imported from SSIS as ANSI (i also tried data conversion in ssis to convert the column to ascii but still to no avail).


Solution

  • "OSC" is CHAR(157). Try using REPLACE(Values, CHAR(157), ''). If it works then you can update in the table. Hope it helps.