EasyManua.ls Logo

Sybase Adaptive Server Anywhere - Page 379

Sybase Adaptive Server Anywhere
1182 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 8 SQL Functions
361
original-string The string to be searched. This can be any length.
search-string The string to be searched for and replaced with replace-
string. This string is limited to 255 bytes. If search-string is an empty string,
the original string is returned unchanged.
replace-string The replacement string, which replaces search-string. This
can be any length. If replacement-string is an empty string, all occurrences
of search-string are deleted.
The following statement returns the value xx.def.xx.ghi.
SELECT REPLACE( ’abc.def.abc.ghi’, ’abc’, ’xx’ )
The following statement generates a result set containing ALTER
PROCEDURE statements which, when executed, would repair stored
procedures that reference a table that has been renamed. (To be useful, the
table name would need to be unique.)
SELECT REPLACE(
replace(proc_defn,’OldTableName’,’NewTableName’),
’create procedure’,
’alter procedure’)
FROM SYS.SYSPROCEDURE
WHERE proc_defn LIKE ’%OldTableName%
Use a separator other than the comma for the LIST function:
SELECT REPLACE( list( table_id ), ’,’, ’--’)
FROM SYS.SYSTABLE
WHERE table_id <= 5
SQL/92 Vendor extension.
Sybase Compatible with Adaptive Server Enterprise.
"SUBSTRING function" on page 369
REPLICATE function [String]
Concatenates a string a specified number of times.
REPLICATE (
string-expression
,
integer-expression
)
string-expression The string to be repeated.
integer-expression The number of times the string is to be repeated.
The following statement returns the value repeatrepeatrepeat.
SELECT REPLICATE( ’repeat’, 3 )
Examples
Standards and
compatibility
See also
Function
Syntax
Parameters
Examples

Table of Contents

Related product manuals