SQL help

AntiFreze

Golden Member
Oct 23, 2007
1,459
0
0
So I attempted the following query to replace:

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?
 

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Hmm, you don't say what DBMS you're on. According to MS for SQL Server argument 1 can be any character or binary data type. But the version you're using must be prototyped differently. Check the docs and see what data types are allowed for that arg.
 

Furor

Golden Member
Mar 31, 2001
1,895
0
0
Try this...

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