Contrary to expectations, the TRANSLATE function has nothing to do with translations. It lets you specify multiple string replacements within a single function. It accepts three input arguments:
- input_string: A string expression that needs to be changed
- characters: A string expression representing characters that should be replaced
- translations: A string expression representing characters that will replace characters specified with a second argument
The function returns a string expression of the same type as the first input argument.
In the following example, the TRANSLATE function is used to replace square brackets with parentheses:
SELECT TRANSLATE('[Sales].[SalesOrderHeader]','[]','()');
Here is the output:
(Sales).(SalesOrderHeader) ...