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

replicate()

The string function replicate() replicates, i.e. duplicates the value declared in the parameter "char_expression" or "uchar_expression". The maximum length of the returned string is 16K.

Syntax of the String Function replicate()

    replicate ( "char_expression" | "uchar_expression",
  integer_expression"
)

The parameters of the String Function replicate()

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

"uchar_expression"
The parameter "uchar_expression" can be a column name, variable or constant and must be of one of the datatypes unichar or univarchar If the parameter "uchar_expression" has a value of NULL then the return value will also be NULL. The parameter must be set in single or double quotes.

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

Example for the String Function replicate()

    select replicate("_-1*", 3)
go
-----
_-1*_-1*_-1*

Returns a string repeating "_-1*_-1*_-1*&qupt; three times.

    select replicate("abc123", 2)
go
-----
abc123abc123

See also:

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