Use of REPLACE Function in SQL:
(1) “REPLACE” function is used to replace characters within the string.
(2) Let’s take an example to replace ‘A’ with ‘T’ in Vendor Name as shown.
(3) Select the database in the SQL server and click on the “New Query” button as shown.
(4) After that new query editor opens as shown.
(5) After doing the above steps, write a query in the editor, as shown.
|–//Use Of REPLACE Function|
Select [No_] AS [Vendor No.],[Name] AS [Vendor Name],
Replace([Name],’A’,’T’)AS [Replace(‘A’ with ‘T’)]
Fromdbo.[CRONUS India Ltd_$Vendor$437dbf0e-84ff-417a-965d-ed2bb9650972]
Where [No_] IN(‘V00040′,’45858585′,’IC1020’)
–//Use Of REPLACE Function
(6) Then Execute or Press F5 to run the query and see the result as shown.
|Use of LOWER Function in SQL|
Use of UPPER Function in SQL
Use of RIGHT Function in SQL
Use of LEFT Function in SQL
REPLACE (Transact-SQL)– Microsoft Docs