|
Category: ASE: Operators
ASE String Operators
A string
operator
is part of a
query,
i.e. an enquiry on a database. There is only one string operator "+" (plus).
It is used to concatenate the strings with, for example, table records.
Example for concatenating strings
In the following example the "+" operator is used to create a
grant
command for the user "user_name" for all
user objects
in the
database
"user_db".
select
"grant all on "+name+" to user_name"
from user_db.sysobjects where type ="U"
When using the string operator for concatenations, some peculiarities need to be noted:
Double inverted commas ("") are equivalent to a blank character. The following
query returns three characters; an ;a" followed by a "blank" and a "b",
so "a b".
The output of a blank character can be avoided using a
NULL
value or the
string function
space().
The following queries return the character string ;ab".
select "a" + space(0) + "b"
See also:
Numeric Operators, Pattern Matching Operators.
|