Editorial / Best Answer
jayaprakash.raman
Please refer that here we are discussing about Sql Server only. There is no function named 'Translate' in Sql Server. 'Translate' function exists in Oracle for translating a single character to some other character.
Replace fucntion in Sql server is used to replace a string as well as character to another string or character. No need to have a seperate function like Transalate in Oracle:
Find below the examples to get the clear idea:
Ex 1: Sql Server replace function similar to Oracle Replace function
Declare @Str varchar(100)
set @Str='India is my country'
print @Str
print replace(@Str,'India','Pakistan')
Result
India is my country
Pakistan is my country
Ex 1: Sql Server replace function similar to Oracle Translate Replace function
Declare @Str varchar(100)
set @Str='Think You'
print @Str
print replace(
@Str,
'i',
'a')
Result
Think You
Thank You
Note: Please try to post Sql server questions only here. Ther is a seperate section available for Oracle. If we mix both, it will confuse the people who are specializing their skill in particular area. Thank you.
What is the difference between "translate" and "replace"?
Profile Answers by Beena Questions by Beena
Questions by Beena answers by Beena
Editorial / Best Answer
jayaprakash.ramanProfile Answers by jayaprakash.raman Questions by jayaprakash.raman
Please refer that here we are discussing about Sql Server only. There is no function named 'Translate' in Sql Server. 'Translate' function exists in Oracle for translating a single character to some other character.
Replace fucntion in Sql server is used to replace a string as well as character to another string or character. No need to have a seperate function like Transalate in Oracle:
Find below the examples to get the clear idea:
Ex 1: Sql Server replace function similar to Oracle Replace function
Declare @Str varchar(100)
set @Str='India is my country'
print @Str
print replace(@Str,'India','Pakistan')
Result
India is my country
Pakistan is my country
Ex 1: Sql Server replace function similar to Oracle Translate Replace function
Declare @Str varchar(100)
set @Str='Think You'
print @Str
print replace(@Str,'i','a')Result
Think You
Thank You
Note: Please try to post Sql server questions only here. Ther is a seperate section available for Oracle. If we mix both, it will confuse the people who are specializing their skill in particular area. Thank you.
Related Answered Questions
Related Open Questions