Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing (permenantly) text within a string

Status
Not open for further replies.

travisbrown

Technical User
Dec 31, 2001
1,016
I'm trying to permanently replace a certain word in all records of a table (SQL SERV 2000). I can of course use the REPLACE syntax; however, this only modifies the output. I think I also could change entire strings, but not text within a string. For example, I need to replace all instances of " with " that may be in a 16,000 character string.

The workaround I've used so far is export the table to Access and use the find/replace function. Doing this, however, is slow and makes me very uneasy.

Any help?
 
Use an update query SQL Server.

Update tblname
Set colname=replace(colname, ' '
-- Add criteria to only select rows where string occurs
Where charinsex(' colname)>0 Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Terry, is there a way to perform this on a text column? I get

"Argument data type text is invalid for argument 1 of replace function."
 
Sorry, nevermind. I remember you dealt with this in another post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top