The SQL STRING_ESCAPE String Function is used to escape special characters from string expression, and returns a string with escaped characters. The basic syntax of the STRING_ESCAPE function is
STRING_ESCAPE (String_Expression, type)
The list of arguments available for STRING_ESCAPE in SQL Server is:
- String_Expression: Please specify a valid String Expression
- type: Currently, this SQL Server function accepts only JSON type
SQL STRING_ESCAPE Example
The following String Function query will show you the examples of string escape.
SELECT STRING_ESCAPE('" /', 'json') AS Escape1; SELECT STRING_ESCAPE('\ /', 'json')AS Escape2; SELECT STRING_ESCAPE('\ " ', 'json') AS Escape3; SELECT STRING_ESCAPE('\ /', 'json') AS Escape4; SELECT STRING_ESCAPE('\ / ', 'json') AS Escape5;