You can modify ntext, text, or image values by:
For example, this query changes the contents of the pr_info column for New Moon Books:
USE pubs
sp_dboption 'pubs', 'select into/bulkcopy', 'true'
DECLARE @ptrval varbinary(16)
SELECT @ptrval = TEXTPTR(pr_info)
FROM pub_info pr INNER JOIN publishers p
ON p.pub_id = pr.pub_id
AND p.pub_name = 'New Moon Books'
WRITETEXT pub_info.pr_info @ptrval 'New Moon Books (NMB) '
sp_dboption 'pubs', 'select into/bulkcopy', 'true'
For example, this query replaces the eighty-eighth character in the text column for New Moon Books (the second letter o in Moon) with the letter z:
USE pubs
sp_dboption 'pubs', 'select into/bulkcopy', 'true'
DECLARE @ptrval varbinary(16)
SELECT @ptrval = TEXTPTR(pr_info)
FROM pub_info pr INNER JOIN publishers p
ON p.pub_id = pr.pub_id
AND p.pub_name = 'New Moon Books'
UPDATETEXT pub_info.pr_info @ptrval 88 1 'z'
sp_dboption 'pubs', 'select into/bulkcopy', 'false'
WRITETEXT | UPDATETEXT |
Using Long Data Types | BLOBs and OLE Objects |
Managing text and image Columns | Text and Image Functions |