TRANSLATE()

Returns the string provided as a first argument, after some characters specified in the second argument are translated into a destination set of characters, specified in the third argument.

Signature

TRANSLATE ( inputString, characters, translations )

Parameters

  • inputString — The string expression to be searched. *inputString* can be any character data type (nvarchar, varchar, nchar, char).
  • characters — A string expression containing characters that should be replaced. *characters* can be any character data type.
  • translations — A string expression containing the replacement characters. *translations* must be the same data type and length as *characters*.

Examples

SELECT TRANSLATE('2*[3+4]/{7-2}', '[]{}', '()()') AS normalised;
normalised
----------------------------------------------------------------
2*(3+4)/(7-2)
SELECT TRANSLATE('2*[3+4]/{7-2}', '[]{}', '()()');
2*(3+4)/(7-2)
SELECT
REPLACE
(
      REPLACE
      (
            REPLACE
            (
                  REPLACE
                  (
                        '2*[3+4]/{7-2}',
                        '[',
                        '('
                  ),
                  ']',
                  ')'
            ),
            '{',
            '('
      ),
      '}',
      ')'
);
2*(3+4)/(7-2)

Run against SQL Server 16.0.4265.3 on 2026-09-13. This is the output we got, not the documentation’s.

Available on

  • SQL Server 2017 and later
  • Azure SQL Managed Instance

Signature and description adapted from the Microsoft SQL documentation, used under the CC BY 4.0. SQL Server and Azure are trademarks of the Microsoft group of companies. This page is not affiliated with Microsoft.