July 17, 2008 at 4:50 pm
I have a column with text datatype. I am trying to replace a certain word in all the rows. This works on a column with varchar datatype but not on text.
Update dbo.navigation_content
Setcontent_body = replace(content_body, 'tax deferred', '1031')
I get this error: Argument data type text is invalid for argument 1 of replace function.
Your help is appreciated.
---------------------
July 17, 2008 at 4:55 pm
You can use the UPDATETEXT method.
http://msdn.microsoft.com/en-us/library/ms189466.aspx
Or cast the text as varchar(8000)
Update dbo.navigation_content
Set content_body = replace(cast(content_body as varchar(8000)), 'tax deferred', '1031')
but the second method could truncate data.
July 17, 2008 at 4:58 pm
I tried UPDATETEXT:
Update dbo.navigation_content
Setcontent_body = UPDATETEXT(content_body, 'tax deferred', '1031')
I get the error: Incorrect syntax near the keyword 'UPDATETEXT'.
July 17, 2008 at 5:16 pm
July 18, 2008 at 10:53 am
Thank you..
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply