Wednesday, August 13, 2008

How to Replace a text in SQL Server Table Column

If you have a Table which has a Column of type char or varchar or even text, and you want to change a portion of text in it for example a path.
In this case you need to change the same text with new one in every records.

Here is the SQL Statement that do this:

UPDATE [TableName] SET [ColumnName] = Replace([ColumnName],'OldText','NewText');

Source: http://www.nilebits.com/blog/2007/09/replace-text-in-a-column-in-sql-server/

Hire Me

Follow me on Facebook

Follow me

Do you find this Blog helpful?

Follow by Email

About Me

My Photo
Expert Senior Software Developer

Microsoft Business Card