Replace text in a column in SQL Server

Replace text in a column in SQL Server

We were working on a database which has a column for storing an image path. The path has been changed and we need now to update that column with the new path.

Please find below a simple SQL update statement that replaces text, you may use it with any column that has type of char, varchar or nvarchar:

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

Share this post

Comments (2)

  • Anonymous Reply

    Thanks ,it ‘s very good , but I want to ask how can I put a picture uploaded from my website in a certain column in my SQL in direct way(by the way I make the column binary datatype) thanks for u A.B

    September 20, 2007 at 2:07 PM
  • Anonymous Reply

    Thanks it worked a treat. I like your syntax names, clear!

    October 20, 2007 at 12:07 PM

Leave a Reply

Your email address will not be published.