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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Replace/Update w/ data_type text

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-02-20 : 09:14:53
Travis writes "I need to replace a string within a field and tried using
UPDATE dbo.CCM_ContentData
SET dat_data = REPLACE(dat_data, 'edmssappt1', 'edmssappp1'); however, I'm getting the error message "Argument data type text is invalid for argument 1 of replace function". Now I understand what this means, but is there a workaround? maybe using CAST, or something."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-02-20 : 09:23:34
You would have to use the UPDATETEXT command in order to do this kind of operation. CAST wouldn't help because you still have to put the value back into the text column, and that will need UPDATETEXT or WRITETEXT.

Look in Books Online for these commands, and also TEXT_PTR(). There's some examples of how they work.

Go to Top of Page
   

- Advertisement -