fnMFReplaceSpecialCharacter

Signature

dbo.fnMFReplaceSpecialCharacter(
    @ColumnName NVARCHAR(2000)
)

Returns

  • NVARCHAR: the input string with special characters replaced according to the connector’s sanitize rules.

Parameters

  • @ColumnName NVARCHAR(2000) (required) - The input text to sanitize.

Purpose

Replace special characters with an underscore, while preserving certain allowed characters (e.g., brackets and the pipe character) and collapsing duplicate underscores.

Examples

SELECT dbo.fnMFReplaceSpecialCharacter('Acme (North)|2023')   AS Result; -- Acme (North)|2023
SELECT dbo.fnMFReplaceSpecialCharacter('A&B / C')             AS Result; -- A_B__C  (then collapsed to A_B_C if logic applies)
SELECT dbo.fnMFReplaceSpecialCharacter('Hello__World!!!')     AS Result; -- Hello_World

Changelog

Date

Author

Description

2023-02-15

LC

add pipe sign to exclusions

2019-08-30

JC

Added documentation

2019-08-06

LC

Add brackets as exclusion

2017-12-03

LC

Fix bug of adding 2 underscores