A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: String Functions

right()

The string function right() returns a string, of characters starting on the right side of the string of characters declared in the parameter "expression". The number of characters returned is specified in the parameter "integer_expression".

Syntax of the String Function right()

    right ( "expression", "integer_expression" )
    

The parameters of the String Function right()

"expression"
The parameter "expression" can be a column name, variable or constant and must be of one of the datatypes char, varchar, nchar, nvarchar, binary, varbinary, unichar or univarchar. If the parameter "expression" has a value of NULL then the return value will also be NULL. The parameter must be set in single or double quotes, if the datatype is char, varchar, nchar, nvarchar, unichar or univarchar.

"integer_expression"
The parameter "integer_expression" can be a column name, variable or constant and must be of one of the datatypes tinyint, smallint or int.

Example for the String Function right()

    select right("abcdefg", 3)
go
-----
efg

Returns "efg".

    select right("1234", 5)
go
-----
1234

Returns "1234".

    select right(0x12345000, 3)
go
-----
0x345000

Returns "0x345000".

See also:

ASE T-SQL - Aggregate Functions,
ascii(),
char(),
char(n),
charindex(),
char_length(),
compare(),
difference(),
lower(),
ltrim(),
patindex(),
replicate(),
reverse(),
rtrim(),
sortkey(),
soundex(),
space(),
str(),
String Functions,
stuff(),
substring(),
to_unichar(),
uhighsurr(),
ulowsurr(),
upper(),
uscalar().