t-sql replace string code example

Example 1: replace string value in sql

UPDATE tableName  SET  fieldName = REPLACE(fieldName, 'fromStringValue', 'toStringValue');

Example 2: replace function in sql

REPLACE function: This function is used 
to replace the existing characters
of all the occurrences.

Example 3: stuff and replace in sql

STUFF Function: This function is used to
overwrite existing character or inserts
a string into another string. 

REPLACE function: This function is used 
to replace the existing characters
of all the occurrences.

Tags:

Sql Example