<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vertica Documentation – String literals</title>
    <link>/en/sql-reference/language-elements/literals/string-literals/</link>
    <description>Recent content in String literals on Vertica Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/sql-reference/language-elements/literals/string-literals/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Sql-Reference: Character string literals</title>
      <link>/en/sql-reference/language-elements/literals/string-literals/character-string-literals/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/literals/string-literals/character-string-literals/</guid>
      <description>
        
        
        &lt;p&gt;Character string literals are a sequence of characters from a predefined character set, enclosed by single quotes.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;character-seq&lt;/span&gt;&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;em&gt;&lt;code&gt;character-seq&lt;/code&gt;&lt;/em&gt;&lt;/dt&gt;
&lt;dd&gt;Arbitrary sequence of characters&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;embedded-single-quotes&#34;&gt;Embedded single quotes&lt;/h2&gt;
&lt;p&gt;If a character string literal includes a single quote, it must be doubled. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#39;Chester&amp;#39;&amp;#39;s gorilla&amp;#39;;
  ?column?
-------------------
Chester&amp;#39;s gorilla
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;a name=&#34;Standard&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;standard-conforming-strings-and-escape-characters&#34;&gt;Standard-conforming strings and escape characters&lt;/h2&gt;
&lt;p&gt;Vertica uses standard-conforming strings as specified in the SQL standard, so backslashes are treated as string literals and not escape characters.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Earlier versions of Vertica did not use standard conforming strings, and backslashes were always considered escape sequences. To revert to this older behavior, set the configuration parameter &lt;a href=&#34;../../../../../en/sql-reference/config-parameters/internationalization-parameters/#StandardConformingStrings&#34;&gt;StandardConformingStrings&lt;/a&gt; to 0. You can also use the &lt;a href=&#34;../../../../../en/sql-reference/config-parameters/internationalization-parameters/#EscapeStringWarning&#34;&gt;EscapeStringWarning&lt;/a&gt; parameter to locate back slashes which have been incorporated into string literals, in order to remove them.

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#39;This is a string&amp;#39;;
  ?column?
------------------
 This is a string
(1 row)
=&amp;gt; SELECT &amp;#39;This \is a string&amp;#39;;
   WARNING:  nonstandard use of escape in a string literal at character 8
   HINT:  Use the escape string syntax for escapes, e.g., E&amp;#39;\r\n&amp;#39;.
     ?column?
------------------
 This is a string
(1 row)
vmartdb=&amp;gt; SELECT E&amp;#39;This \is a string&amp;#39;;
     ?column?
------------------
 This is a string
=&amp;gt; SELECT E&amp;#39;This is a \n new line&amp;#39;;
       ?column?
----------------------
 This is a
 new line
(1 row)
=&amp;gt; SELECT &amp;#39;String&amp;#39;&amp;#39;s characters&amp;#39;;
      ?column?
--------------------
 String&amp;#39;s characters
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/set-statements/set-standard-conforming-strings/&#34;&gt;SET STANDARD_CONFORMING_STRINGS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/set-statements/set-escape-string-warning/&#34;&gt;SET ESCAPE_STRING_WARNING&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/admin/configuring-db/config-procedure/implement-locales-international-data-sets/&#34;&gt;Implement locales for international data sets&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Dollar-quoted string literals</title>
      <link>/en/sql-reference/language-elements/literals/string-literals/dollar-quoted-string-literals/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/literals/string-literals/dollar-quoted-string-literals/</guid>
      <description>
        
        
        &lt;p&gt;Dollar-quoted string literals are rarely used, but are provided here for your convenience.&lt;/p&gt;
&lt;p&gt;The standard syntax for specifying string literals can be difficult to understand. To allow more readable queries in such situations, Vertica SQL provides &lt;em&gt;&lt;strong&gt;&lt;code&gt;dollar quoting&lt;/code&gt;&lt;/strong&gt;&lt;/em&gt;. Dollar quoting is not part of the SQL standard, but it is often a more convenient way to write complicated string literals than the standard-compliant single quote syntax.
&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$$&lt;span class=&#34;code-variable&#34;&gt;characters&lt;/span&gt;$$
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;characters&lt;/span&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Arbitrary sequence of characters bounded by paired dollar signs (&lt;code&gt;$$&lt;/code&gt;)&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;Dollar-quoted string content is treated as a literal. Single quote, backslash, and dollar sign characters have no special meaning within a dollar-quoted string.&lt;/p&gt;
&lt;h2 id=&#34;notes&#34;&gt;Notes&lt;/h2&gt;
&lt;p&gt;A dollar-quoted string that follows a keyword or identifier must be separated from the preceding word by whitespace; otherwise, the dollar-quoting delimiter is taken as part of the preceding identifier.
&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT $$Fred&amp;#39;s\n car$$;
     ?column?
-------------------
 Fred&amp;#39;s\n car
(1 row)

=&amp;gt; SELECT &amp;#39;SELECT &amp;#39;fact&amp;#39;;&amp;#39;;
ERROR:  syntax error at or near &amp;#34;&amp;#39;;&amp;#39;&amp;#34; at character 21
LINE 1: SELECT &amp;#39;SELECT &amp;#39;fact&amp;#39;;&amp;#39;;

=&amp;gt; SELECT &amp;#39;SELECT $$fact&amp;#39;;$$;
   ?column?
---------------
 SELECT $$fact
(1 row)

=&amp;gt; SELECT &amp;#39;SELECT &amp;#39;&amp;#39;fact&amp;#39;&amp;#39;;&amp;#39;;
    ?column?
----------------
 SELECT &amp;#39;fact&amp;#39;;
(1 row)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Unicode string literals</title>
      <link>/en/sql-reference/language-elements/literals/string-literals/unicode-string-literals/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/literals/string-literals/unicode-string-literals/</guid>
      <description>
        
        
        &lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;U&amp;amp;&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;characters&lt;/span&gt;&amp;#39; [ UESCAPE &amp;#39;&amp;lt;&lt;span class=&#34;code-variable&#34;&gt;Unicode escape character&lt;/span&gt;&amp;gt;&amp;#39; ]
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;characters&lt;/span&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Arbitrary sequence of UTF-8 characters bounded by single quotes (&#39;)&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;Unicode escape character&lt;/span&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;A single character from the source language character set other than a hexit, plus sign (+), quote (&#39;), double quote (&#39;&#39;), or white space&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;using-standard-conforming-strings&#34;&gt;Using standard conforming strings&lt;/h2&gt;
&lt;p&gt;With &lt;code&gt;StandardConformingStrings&lt;/code&gt; enabled, Vertica supports SQL standard Unicode character string literals (the character set is UTF-8 only).&lt;/p&gt;
&lt;p&gt;Before you enter a Unicode character string literal, enable standard conforming strings in one of the following ways.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To enable for all sessions, update the configuration parameter &lt;a href=&#34;../../../../../en/sql-reference/config-parameters/internationalization-parameters/#StandardConformingStrings&#34;&gt;StandardConformingStrings&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To treat backslashes as escape characters for the current session, use the &lt;a href=&#34;../../../../../en/sql-reference/statements/set-statements/set-standard-conforming-strings/&#34;&gt;SET STANDARD_CONFORMING_STRINGS&lt;/a&gt; statement.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See also &lt;a href=&#34;../../../../../en/sql-reference/language-elements/literals/string-literals/extended-string-literals/&#34;&gt;Extended String Literals&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;To enter a Unicode character in hexadecimal, such as the Russian phrase for &amp;quot;thank you, use the following syntax:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SET STANDARD_CONFORMING_STRINGS TO ON;
=&amp;gt; SELECT U&amp;amp;&amp;#39;\0441\043F\0430\0441\0438\0431\043E&amp;#39; as &amp;#39;thank you&amp;#39;;
 thank you
-----------
 спасибо
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;
To enter the German word &lt;code&gt;mude&lt;/code&gt; (where &lt;code&gt;u&lt;/code&gt; is really u-umlaut) in hexadecimal:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT U&amp;amp;&amp;#39;m\00fcde&amp;#39;;
?column?
----------
müde
(1 row)
=&amp;gt; SELECT &amp;#39;ü&amp;#39;;
?column?
----------
ü
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To enter the &lt;code&gt;LINEAR B IDEOGRAM B240 WHEELED CHARIOT&lt;/code&gt; in hexadecimal:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT E&amp;#39;\xF0\x90\x83\x8C&amp;#39;;
?column?
----------
(wheeled chariot character)
(1 row)
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Not all fonts support the wheeled chariot character.

&lt;/div&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/set-statements/set-standard-conforming-strings/&#34;&gt;SET STANDARD_CONFORMING_STRINGS&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/statements/set-statements/set-escape-string-warning/&#34;&gt;SET ESCAPE_STRING_WARNING&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/sql-reference/config-parameters/internationalization-parameters/&#34;&gt;Internationalization parameters&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../../en/admin/configuring-db/config-procedure/implement-locales-international-data-sets/&#34;&gt;Implement locales for international data sets&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Sql-Reference: VARBINARY string literals</title>
      <link>/en/sql-reference/language-elements/literals/string-literals/varbinary-string-literals/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/literals/string-literals/varbinary-string-literals/</guid>
      <description>
        
        
        &lt;p&gt;VARBINARY string literals allow you to specify hexadecimal or binary digits in a string literal.&lt;/p&gt;
&lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;X&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;&lt;hexadecimal digits&gt;&#39;&lt;/span&gt;
B&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;&lt;binary digits&gt;&#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;X&lt;/code&gt; or &lt;code&gt;x&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Specifies hexadecimal digits. The &amp;lt;&lt;em&gt;hexadecimal digits&lt;/em&gt;&amp;gt; string must be enclosed in single quotes (&#39;).&lt;/dd&gt;
&lt;dt&gt;&lt;code&gt;B&lt;/code&gt; or &lt;code&gt;b&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Specifies binary digits. The &lt;em&gt;&amp;lt;binary digits&amp;gt;&lt;/em&gt; string must be enclosed in single quotes (&#39;).&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT X&amp;#39;abcd&amp;#39;;
 ?column?
----------
 \253\315
(1 row)

=&amp;gt; SELECT B&amp;#39;101100&amp;#39;;
 ?column?
----------
 ,
(1 row)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
    <item>
      <title>Sql-Reference: Extended string literals</title>
      <link>/en/sql-reference/language-elements/literals/string-literals/extended-string-literals/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/sql-reference/language-elements/literals/string-literals/extended-string-literals/</guid>
      <description>
        
        
        &lt;h2 id=&#34;syntax&#34;&gt;Syntax&lt;/h2&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;E&amp;#39;&lt;span class=&#34;code-variable&#34;&gt;characters&lt;/span&gt;&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;parameters&#34;&gt;Parameters&lt;/h2&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;code&gt;&lt;span class=&#34;code-variable&#34;&gt;characters&lt;/span&gt;&lt;/code&gt;&lt;/dt&gt;
&lt;dd&gt;Arbitrary sequence of characters bounded by single quotes (&#39;)

You can use C-style backslash sequence in extended string literals, which are an extension to the SQL standard. You specify an extended string literal by writing the letter E as a prefix (before the opening single quote); for example:&lt;/dd&gt;
&lt;/dl&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;E&amp;#39;extended character string\n&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Within an extended string, the backslash character (&lt;code&gt;\&lt;/code&gt;) starts a C-style backslash sequence, in which the combination of backslash and following character or numbers represent a special byte value, as shown in the following list. Any other character following a backslash is taken literally; for example, to include a backslash character, write two backslashes (&lt;code&gt;\\&lt;/code&gt;).&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\\&lt;/code&gt; is a backslash&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\b&lt;/code&gt; is a backspace&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\f&lt;/code&gt; is a form feed&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\n&lt;/code&gt; is a newline&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\r&lt;/code&gt; is a carriage return&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\t&lt;/code&gt; is a tab&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\x##,&lt;/code&gt;where &lt;code&gt;##&lt;/code&gt; is a 1 or 2-digit hexadecimal number; for example \x07 is a tab&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;\###&lt;/code&gt;, where &lt;code&gt;###&lt;/code&gt; is a 1, 2, or 3-digit octal number representing a byte with the corresponding code.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When an extended string literal is concatenated across lines, write only &lt;code&gt;E&lt;/code&gt; before the first opening quote:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT E&amp;#39;first part o&amp;#39;
    &amp;#39;f a long line&amp;#39;;
         ?column?
---------------------------
 first part of a long line
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Two adjacent single quotes are used as one single quote:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#39;Aren&amp;#39;&amp;#39;t string literals fun?&amp;#39;;
          ?column?
-----------------------------
 Aren&amp;#39;t string literals fun?
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;standard-conforming-strings-and-escape-characters&#34;&gt;Standard conforming strings and escape characters&lt;/h2&gt;
&lt;p&gt;When interpreting commands, such as those entered in &lt;a class=&#34;glosslink&#34; href=&#34;../../../../../en/glossary/vsql/&#34; title=&#34;For more information, see Installing the vsql Client and the more general topic, Using vsql.&#34;&gt;vsql&lt;/a&gt; or in queries passed via JDBC or ODBC, Vertica uses standard conforming strings as specified in the SQL standard. In standard conforming strings, backslashes are treated as string literals (ordinary characters), not escape characters.

&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Text read in from files or streams (such as the data inserted using the &lt;a href=&#34;../../../../../en/sql-reference/statements/copy/&#34;&gt;COPY&lt;/a&gt; statement) are not treated as literal strings. The COPY command defines its own escape characters for the data it reads. See the &lt;a href=&#34;../../../../../en/sql-reference/statements/copy/&#34;&gt;COPY&lt;/a&gt; statement documentation for details.

&lt;/div&gt;

The following options are available, but Vertica recommends that you migrate your application to use standard conforming strings at your earliest convenience, after warnings have been addressed.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;To treat back slashes as escape characters, set configuration parameter 
&lt;code&gt;&lt;a href=&#34;../../../../../en/sql-reference/config-parameters/internationalization-parameters/&#34;&gt;StandardConformingStrings&lt;/a&gt;&lt;/code&gt; to 0.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To enable standard conforming strings permanently, set the &lt;code&gt;StandardConformingStrings&lt;/code&gt; parameter to &#39;1&#39;, as described &lt;a href=&#34;#Identify&#34;&gt;below&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To enable standard conforming strings per session, use &lt;a href=&#34;../../../../../en/sql-reference/statements/set-statements/set-standard-conforming-strings/&#34;&gt;SET STANDARD_CONFORMING_STRING TO ON&lt;/a&gt;, which treats backslashes as escape characters for the current session only.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a name=&#34;Identify&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;identifying-strings-that-are-not-standard-conforming&#34;&gt;Identifying strings that are not standard conforming&lt;/h2&gt;
&lt;p&gt;The following procedure can be used to identify nonstandard conforming strings in your application so that you can convert them into standard conforming strings:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Be sure the &lt;code&gt;StandardConformingStrings&lt;/code&gt; parameter is off, as described in &lt;a href=&#34;../../../../../en/sql-reference/config-parameters/internationalization-parameters/&#34;&gt;Internationalization parameters&lt;/a&gt;.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER DATABASE DEFAULT SET StandardConformingStrings = 0;
&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

Vertica recommends that you migrate your application to use standard conforming strings .

&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If necessary, turn on the &lt;code&gt;EscapeStringWarning&lt;/code&gt; parameter.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER DATABASE DEFAULT SET EscapeStringWarning = 1;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Vertica now returns a warning each time it encounters an escape string within a string literal. For example, Vertica interprets the &lt;code&gt;\n&lt;/code&gt; in the following example as a new line:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#39;a\nb&amp;#39;;
   WARNING:  nonstandard use of escape in a string literal at character 8
   HINT:  Use the escape string syntax for escapes, e.g., E&amp;#39;\r\n&amp;#39;.
 ?column?
----------
 a
b
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When &lt;code&gt;StandardConformingStrings&lt;/code&gt; is &lt;code&gt;ON&lt;/code&gt;, the string is interpreted as four characters: &lt;code&gt;a \ n b&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Modify each string that Vertica flags by extending it as in the following example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;E&amp;#39;a\nb&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Or if the string has quoted single quotes, double them; for example, &lt;code&gt;&#39;one&#39;&#39; double&#39;.&lt;/code&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Turn on the &lt;code&gt;StandardConformingStrings&lt;/code&gt; parameter for all sessions:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; ALTER DATABASE DEFAULT SET StandardConformingStrings = 1;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;doubled-single-quotes&#34;&gt;Doubled single quotes&lt;/h2&gt;
&lt;p&gt;This section discusses vsql inputs that are not passed on to the server.

Vertica recognizes two consecutive single quotes within a string literal as one single quote character. For example, the following inputs, &lt;code&gt;&#39;You&#39;&#39;re here!&#39;&lt;/code&gt; ignored the second consecutive quote and returns the following:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#39;You&amp;#39;&amp;#39;re here!&amp;#39;;
   ?column?
--------------
 You&amp;#39;re here!at
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This is the SQL standard representation and is preferred over the form, &lt;code&gt;&#39;You\&#39;re here!&#39;&lt;/code&gt;, because backslashes are not parsed as before. You need to escape the backslash:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT (E&amp;#39;You\&amp;#39;re here!&amp;#39;);
   ?column?
--------------
 You&amp;#39;re here!
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This behavior change introduces a potential incompatibility in the use of the vsql meta-command &lt;code&gt;\set&lt;/code&gt;, which automatically concatenates its arguments. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;\set file  &amp;#39;\&amp;#39;&amp;#39;  &amp;#39;pwd&amp;#39;  &amp;#39;/file.txt&amp;#39;  &amp;#39;\&amp;#39;&amp;#39;\echo :file
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;vsql takes the four arguments and outputs the following:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#39;/home/vertica/file.txt&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Vertica parses the adjacent single quotes as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;\set file  &amp;#39;\&amp;#39;&amp;#39;&amp;#39;pwd&amp;#39;&amp;#39;/file.txt&amp;#39;&amp;#39;\&amp;#39;&amp;#39;\echo :file
&amp;#39;/home/vertica/file.txt&amp;#39;&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note the extra single quote at the end. This is due to the pair of adjacent single quotes together with the backslash-quoted single quote.&lt;/p&gt;
&lt;p&gt;The extra quote can be resolved either as in the first example above, or by combining the literals as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;\set file &amp;#39;\&amp;#39;&amp;#39;`pwd`&amp;#39;/file.txt&amp;#39;&amp;#39;&amp;#39;\echo :file
&amp;#39;/home/vertica/file.txt&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In either case the backslash-quoted single quotes should be changed to doubled single quotes as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;\set file &amp;#39;&amp;#39;&amp;#39;&amp;#39; `pwd` &amp;#39;/file.txt&amp;#39;&amp;#39;&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;additional-examples&#34;&gt;Additional examples&lt;/h2&gt;

&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT &amp;#39;This \is a string&amp;#39;;
     ?column?
------------------
 This \is a string
(1 row)

=&amp;gt; SELECT E&amp;#39;This \is a string&amp;#39;;
     ?column?
------------------
 This is a string

=&amp;gt; SELECT E&amp;#39;This is a \n new line&amp;#39;;
       ?column?
----------------------
 This is a
 new line
(1 row)

=&amp;gt; SELECT &amp;#39;String&amp;#39;&amp;#39;s characters&amp;#39;;
      ?column?
--------------------
 String&amp;#39;s characters
(1 row)
&lt;/code&gt;&lt;/pre&gt;
      </description>
    </item>
    
  </channel>
</rss>
