Total Page Preview:   000000002755

What is replace function in SQL in English and Hindi


Replace function in English

The REPLACE function in SQL is used to replace all occurrences of a specified string value with another string value within a given string. The syntax for the REPLACE function is as follows:

  • string_expression: The string that will be searched for the specified string pattern.
  • string_pattern: The string value that will be searched for and replaced.
  • string_replacement: The string value that will replace all occurrences of the specified string pattern in the string_expression.
Here is an example of using the REPLACE function in SQL:
Suppose we have a table named Employee with the following data:
Now, we want to update the address of all employees who live on Main St. We can use the REPLACE function to accomplish this as follows:
In this example, the REPLACE function is used to replace all occurrences of the string 'Main St.' with 'Maple St.' in the Address column for any row that contains the string 'Main St.' in their address.
After running the above query, the data in the Employee table will be updated as follows:
As we can see, all occurrences of the string 'Main St.' in the Address column have been replaced with 'Maple St.' using the REPLACE function.



Replace function in Hindi

REPLACE function SQL mein ek aisa function hai jo diye gaye string mein specified string pattern ko dusre string value se replace karta hai. REPLACE function ka syntax is tarah hota hai:

  • string_expression: yah woh string hai jisme specified string pattern ko search kiya jayega.
  • string_pattern: yah woh string value hai jo search kiya jayega aur replace kiya jayega.
  • string_replacement: yah woh string value hai jo specified string pattern ke saare occurrences ko string_expression mein replace karega.
Yahan ek SQL mein REPLACE function ka example diya gaya hai:
Maan lijiye humare paas ek table hai Employee jisme niche diye gaye data hai:
Ab hum chahte hain ki Main St. par rahne wale sabhi karmachariyon ki address update ho jaye. Hum REPLACE function ka upyog is tarah se kar sakte hain:
Is example mein REPLACE function ka upyog kiya gaya hai string 'Main St.' ke saare occurrences ko 'Maple St.' se replace karne ke liye Address column mein, jahan bhi kisi row mein unke address mein 'Main St.' string ki occurrence hai.
Upar diye gaye query ko chalane ke baad, Employee table ke data ko update kiya jayega jaisa ki niche diya gaya hai:
Jaisa ki dekha ja sakta hai, Address column mein 'Main St.' string ke saare occurrences REPLACE function ka upyog karke 'Maple St.' se replace ho gaye hai.




Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn :





Facebook User: