For the complete documentation index, see llms.txt. This page is also available as Markdown.

PreserveSingleQuotes

Prevents from automatically escaping single quotation mark characters that are contained in a variable.

It is not neccesary to use this function around listQualify() when the qualifier is a single quote, or around quotedValueList() as those automatically preserve and escape single quotes as needed when used inside a query component.

Method Signature

PreserveSingleQuotes(variable=[String])

Arguments

Argument
Type
Required
Description
Default

variable

String

true

The expression that needs to have its single quotes preserved.

Examples

Preserve single quotes in a SQL string

Prevents double-escaping of single quotes in dynamic SQL.

sql = "SELECT * FROM users WHERE name = '#preserveSingleQuotes( "O'Brien" )#'";
writeOutput( sql.contains( "O'Brien" ) );

Result: true

Last updated

Was this helpful?