Strings
Strings
Special characters
in strings
Compatibility
224
Strings are of the following types:
♦
literal strings
♦
expressions with CHAR or VARCHAR data types.
An expression with a CHAR data type may be a built-in or user-defined
function, or one of the many other kinds of expressions available.
$
For more information on expressions, see "Expressions" on page 230.
A literal string is any sequence of characters enclosed in apostrophes ('single
quotes'). A SQL variable of character data type can hold a string. The
following is a simple example of a literal strings:
'This is a string.'
You represent special character in strings by escape sequences, as follows:
♦
To represent an apostrophe inside a string, use two apostrophes in a row.
For example:
'John''s database'
♦
To represent a new line character, use a backslash followed by n (\n).
For example:
'First line:\nSecond line:'
♦
To represent a backslash character, use two backslashes in a row (\\). For
example:
'c:\\temp'
♦
Hexadecimal escape sequences can be used for any character, printable
or not. A hexadecimal escape sequence is a backslash followed by an x
followed by two hexadecimal digits (for example, \x6d represents the
letter m). For example:
'\x00\x01\x02\x03'
For compatibility with Adaptive Server Enterprise, you can set the
QUOTED_IDENTIFIER database option to OFF. With this setting, you can
also use double quotes to mark the beginning and end of strings. The option
is set to ON by default.
Need help?
Do you have a question about the Adaptive Server Anywhere and is the answer not in the manual?
Questions and answers