Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

UpdateText() not working correctly

I'm trying to run the following SQL against my column, Testtbl.Task

I want to replace where the ampersand sign got HTML encoded to
"&", and I want to strip it down to only the ampersand sign and delete the "amp" and the ";".

It executes, but I still have the HTML encoding for the ampersand sign.

USE WI
GO
EXEC sp_dboption 'WI', 'select into/bulkcopy', 'true'
GO
DECLARE @ptrval binary(16)
SELECT @ptrval = TEXTPTR(Task)
FROM Testtbl
WHERE Task like '%amp;%'
UPDATETEXT Testtbl.Task @ptrval 88 0 ''
GO
EXEC sp_dboption 'WI', 'select into/bulkcopy', 'false'
GO
[739 byte] By [bubberz] at [2007-11-11 8:45:58]
# 1 Re: UpdateText() not working correctly
Sorry...line should have been:

UPDATETEXT Testtbl.Task @ptrval 0 8

...since the start will be at the "amp;" (0), and for each character it's 2 bytes (8), and with saying nothing for the update text, it just deletes the "amp;"...at least that's what books online says, but I'm missing something.
bubberz at 2007-11-11 23:46:57 >