• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

B.2. Alphabetical List of Functions > PreserveSingleQuotes

Name

PreserveSingleQuotes

Synopsis

                    PreserveSingleQuotes(variable)

Returns variable without escaping single quotation marks. PreserveSingleQuotes( ) keeps ColdFusion from automatically escaping single quotation marks within dynamically set variables. The PreserveSingleQuotes( ) function is most often used with SQL statements when it is necessary to pass dynamically generated values. Example:

<cfset Names = "'Pere Money','Mark Edward','Marcel Haney'">
   
<cfquery name="GetRecords" datasource="ProgrammingCF">
         SELECT * FROM EmployeeDirectory
         WHERE Name IN (#PreserveSingleQuotes(Names)#)
</cfquery>
   
<cfoutput>#GetRecords.RecordCount# record(s) found.</cfoutput>


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint