Some time we don't need to show the data as it in database for example in SQL Server database i have a table and there is data like Delhi but i want to display it as New Delhi in front end then Replace is very useful inbuilt function in SQL Server. All query which is given in this article is tested in SQL Server 2005 as well as 2008.
REPLACE is inbuilt function in SQL SERVER. REPLACE Take three parameter and syntax of REPLACE function in SQL Server is
REPLACE('Expression','String to replace','Replacement String')
SELECT REPLACE('CODE BY TOPIC','C','R');
RTDE BY TOPIC
REPLACE is inbuilt function in SQL SERVER. REPLACE Take three parameter and syntax of REPLACE function in SQL Server is
REPLACE('Expression','String to replace','Replacement String')
SQL Server Replace function - Example 1:
Output of above example
RODE BY TOPIR
Another example of Replace Example 2:
SELECT REPLACE('CODE BY TOPIC','C','RT');
Output Is:
RTODE BY TOPIRT
Example 3:
SELECT REPLACE('CODE BY TOPIC','CO','RT');
Another example of Replace Example 2:
Example 3:
Output Is:
RTDE BY TOPIC
0 comments:
Post a comment