STRING_ESCAPE
string transform
What changes
- Input
- string arguments
- Output or change
- string or integer
- Return type
- nvarchar(max) text with escaped special and control characters. Currently STRING_ESCAPE can only escape JSON special characters shown in the following tables. Special character Encoded sequence Quotat
Syntax at a glance
STRING_ESCAPE( text , type )
Work example
Escape characters for a documented string serialization format such as JSON.
Keep JSON generation on JSON functions and use STRING_ESCAPE only for its supported escape rules.
Check your work Escaping does not validate a complete document or make text safe for every output context.
Open Microsoft Learn for full syntax, permissions, and details for your version.