Using MS SQL 2016. The database Collation = SQL_Latin1_General_CP1_CI_AS.
Sometimes a string in a particular column [nvarchar(254)] contains one or more special characters, but sometimes those characters are no visible. When visible, they show like little boxes. See attached image. I found this: T-SQL Function to get ASCII values of characters stored. In this example, it tells me the character is a question mark, ascii code #63. I then use the code shown below to replace the question mark (and any other special characters) with an underscore but it won't do it. If the special character is visible, the code works. What am I doing wrong?
UPDATE TableName
set C_DESCRIPT=Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(
Replace(C_DESCRIPT,char(60),'-'),char(62),'-'),char(58),'-'),char(34),'-'),char(47), '-'),
char(92),'-'),char(124),'-'), char(63),'-'), char(42),'-')
where CUSTOM_ALIAS='272968'