Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UpdateText() not working correctly

Status
Not open for further replies.

clanm

Programmer
Joined
Dec 26, 2005
Messages
237
Location
US
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top