Translate function in Sql server 2017

With the new translate function in SQL server 2017 you can now replace the string for multiple characters at the same time. In earlier version of SQL server with replace function we have to use replace multiple times if we have to replace the string multiple times .

Below is the syntax for Translate function inĀ  SQL server 2017.

Syntax : TRANSLATE ( inputString, characters, translations)

Below is the example of translate function in SQL server 2017.

 

 

select replace(replace(‘***sqlag####’,’*’,’.’),’#’, ‘.’) as Replace_output

select translate(‘***sqlag###’, ‘*#’,’..’) as Translate_output

 

Translate function in SQL server 2017
Translate function in SQL server 2017

 

 

 1,574 total views,  1 views today

Add a Comment

Your email address will not be published. Required fields are marked *