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

  • Anonymous 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

    Thursday, September 20, 2007 at 02:07 PM
  • Anonymous Anonymous Reply

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

    Saturday, October 20, 2007 at 12:07 PM

Leave a comment


Previous Post

Next Post