Percentage sign (%) in an INSERT
21,594
Solution 1
UPDATE Mortgage SET TEXT = 'The interest rate is 7' + CHAR(37);
37 is the decimal ASCII code for a percent symbol.
Solution 2
You can use a custom escape character, for example:
UPDATE Mortgage
SET TEXT = 'The interest rate is 7\%' ESCAPE '\';
But I think you didn't need to escape this character %
here becouse it has no special meaning as an input value, but you have to escape it in case you want to use it in a LIKE
query.
Author by
Admin
Updated on October 06, 2020Comments
-
Admin over 3 years
I have to change values into my database. One of the string values can contain a
%
sign.Rough example:
UPDATE Mortgage SET TEXT = 'The interest rate is 7%';
The change is not saved in the database. How can I escape the percentage sign in SQL Server