Skip to content

Commit 26f80db

Browse files
authored
Update to add clarity to how TRANSLATE works
The previous description makes it sound like TRANSLATE will not make multiple replacements. Many people think it won't replace say all the square brackets when using TRANSLATE('[[00]] 2343:2342', '[]:', '()-') and that only the first instance of each character would be replaced. This isn't how the function works, so I've added text to clarify.
1 parent e522324 commit 26f80db

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

docs/t-sql/functions/translate-transact-sql.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ Returns a character expression of the same data type as `inputString` where char
4848

4949
`TRANSLATE` will return an error if *characters* and *translations* expressions have different lengths. `TRANSLATE` will return NULL if any of the arguments are NULL.
5050

51-
The behavior of the `TRANSLATE` function is similar to using multiple [REPLACE](../../t-sql/functions/replace-transact-sql.md) functions. `TRANSLATE` does not, however, replace a character more than once. This is dissimilar to multiple `REPLACE` functions, as each use would replace all relevant characters.
51+
The behavior of the `TRANSLATE` function is similar to using multiple [REPLACE](../../t-sql/functions/replace-transact-sql.md) functions. `TRANSLATE` does not, however, replace any individual character in `inputString` more than once. A single value in the `characters` parameter, can replace multiple characters in `inputString`.
52+
53+
This is dissimilar to the behavior of multiple `REPLACE` functions, as each function call would replace all relevant characters, even if they had been replaced by a previous nested `REPLACE` function call.
5254

5355
`TRANSLATE` is always SC collation aware.
5456

0 commit comments

Comments
 (0)