fn_smart_replace (Transact_SQL)

See also:


Scalar UDF that performs, in addition to normal replace, replacement of variable length repeated sequences of characters.
 

Syntax

 fn_smart_replace(@string,@search_for,@replace_with,@min_replace_len, @max_replace_len)

Arguments

@string NVARCHAR(4000) = string to search for replacements into

@min_replace_len INT (default 1) = min length for replace

@replace_with NVARCHAR(4000) = substitution string  

@search_for NVARCHAR(4000) = substring to search in the @string parameter

@max_replace_len INT =max lenght to replace

 

Return type

NVARCHAR(4000)

Remarks

none

 

Permissions

Public

 

Dependencies

none

 

Examples

 

SELECT [Lib].[tsql].[fn_smart_replace] ('This is an example of repeeeeeeeated chars','e','',2,6) 

 Result: This is an example of repeated chars

 

 

Other

none

 

Last edited Aug 23, 2012 at 12:29 PM by adudau, version 5

Comments

No comments yet.