Previous Topic

Next Topic

Inhoudsopgave

Book Index

Str_Replace

Str_Replace( char_expr_1, char_expr_2, char_expr_3 )

Replaces all occurrences of char_expr_2 in char_expr_1 with char_expr_3.

Example

select Str_Replace( 'aXbXc', 'X', '-' )

Differences

In MS SQL Server the function is called Replace instead of Str_Replace. The only differences in behavior are when using NULL or empty string arguments.

In the table below, '' denotes the empty string and the symbol ∙ represents a space.

 

ASE

MS SQL Server

Str_Replace( '', 'X', '-' )

'∙'

''

Str_Replace( 'aXbXc', '', '-' )

'aXbXc'

'aXbXc'

Str_Replace( 'aXbXc', 'X', '' )

'a∙b∙c'

'abc'

Str_Replace( NULL, 'X', '-' )

NULL

NULL

Str_Replace( 'aXbXc', NULL, '-' )

NULL

NULL

Str_Replace( 'aXbXc', 'X', NULL )

'abc'

NULL