Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Find Replace?

Author  Topic 

phrankbooth
Posting Yak Master

162 Posts

Posted - 2008-01-09 : 17:18:08
Hello,

Wondering if anyone may have any advice on how to do this?

I need to do Find/Replace of text in a varchar field so that it looks for text I want then it replaces that text with the new text and updates the field with that specific change, leaving everything else intact.

And I need to do this for every row in a table.

Thanks in advance!!

--PhB

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-01-09 : 17:39:00
Update [Field]
Set [Field] = REPLACE([Field],"oldtext","newtext")




Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

phrankbooth
Posting Yak Master

162 Posts

Posted - 2008-01-09 : 19:37:34
Thanks!

Will this replace "abc" with "xyz" if the entire text of the field is "123abcdefghi" so that the field remains intact as "123xyzdefghi" ?

Or is that a whole text replacement command?
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-01-09 : 20:43:35
Just the text you specify will be replaced, the rest will remain intact





Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page
   

- Advertisement -