|
left()
The
String Funktion
left()
returns the number of characters in a string,
starting from the left. The length of the return value is specified
by the value of the parameter of the function.
The function left() is equivalent to the function
substring.
left() is an extension of
T-SQL
and can be executed by any
user.
Syntax of the String Function left()
left( expression, length )
The Parameters of the String Function left()
"expression"
A substring of the value in the parameter "expression"
is returned.
The parameter must be set in single or double quotes.
It can conist of
column names,
variables
or
constants
and must be of one of the
datatypes
varchar,
nvarchar
(but not
image
or
text), or in a datatype which can be
converted into one of the required datatypes using
implicit conversion.
If the value of the parameter "expression" is a
NULL-value,
the return value will also be NULL.
"length"
The parameter "length" determines the number of characters
to be returned of "expression", starting from the left side
of the string.
The value must be of
datatype
int.
A negative value for the parameter "length" will return
an error message.
Example for the String Function left()
select left("abcdefg", 3)
go
------
abc
Returns the substring "abc".
See also:
ASE T-SQL - Aggregate Functions, ascii(), char(), char(n), charindex(), char_length(), compare(), difference(), lower(), ltrim(), patindex(), replicate(), reverse(), right(), rtrim(), sortkey(), soundex(), space(), str(), String Functions, stuff(), substring(), to_unichar(), uhighsurr(), ulowsurr(), upper(), uscalar().
|