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
 trying to run a replace on TEXT

Author  Topic 

antifreze
Starting Member

5 Posts

Posted - 2008-06-26 : 13:48:52
So I attempted the following query to replace all references of 'href="/' to 'href="../'

Update table_one
Set Content = replace(Content, 'href="../','href="../')

and I get a "argument data type text is invalid for argument 1 of replace function."


So I do some research and find that the STUFF function can work on text, so I write this:

Select Content, STUFF(Content, CharIndex('href="/', Content), 7, 'href="../') FROM table_one

and I get the same error "argument data type text is invalid for argument 1 of stuff function."


Are there any other solutions to this?

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-06-26 : 13:52:26
Read about UPDATETEXT in sql server help file

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-06-26 : 13:53:29
Try using UPDATETEXT as given here:-

http://www.sqlservercentral.com/articles/Miscellaneous/handlingthetextdatatype/985/
Go to Top of Page
   

- Advertisement -