PP:
Thank you for your response. I have found plenty of examples of how to change NTEXT for a given table and/or column. I need a global search and replace to change the TEXT and NTEXT fields across all fields in all tables of the database. The code above does this, I just can't get the Update to work. If I replace this code:
UPDATE VendorProducts SET @ColumnName= SUBSTRING(@ColumnName , 0,PATINDEX(@SearchStr2 , @ColumnName)-1)
WHERE PATINDEX(@SearchStr2, @ColumnName) > 0
Main Topics
Browse All Topics





by: paulop1975Posted on 2008-05-17 at 14:46:05ID: 21590853
You can try to follow this article on Searching and Replacing text on TEXT columns: http://www.sqlteam.com/art icle/searc h-and-repl ace-in-a-t ext- column
NOTICE this paragraph in the article: "In this way any row the contains the searched text will have first occurrence of that text replaced with the new value. If you have more than one occurrencies of your text, and you need all of them replaced, you just have to execute this script until the select statement bound to the cursor return 0 rows."
Cheers,
PP
Select allOpen in new window