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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generic UPDATETEXT syntax

Status
Not open for further replies.

richey1

Technical User
Oct 5, 2004
184
GB
Hi

I have a column of type ntext which i want to remove certain words within - for example I want to replace hspace="0" in the one below with nothing i.e. remove it.

is there a generic function for just removing chunks of text using UPDATETEXT - so for the example below I say I want to remove hspace="0"

thanks
ian

<img title="test" height="1" alt="test" hspace="0"
src="images/1.gif" width="1"
longdesc="longdescription.asp?imagename=1.gif" />
 
Look up the function Replace() in BOL.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
thanks karl

I thought replace couldn't be used with ntext unless you could guarantee (which I can't) the characters wouldn't exceeed 4000 ?
I've used the function below - will that work ok for all ntext entries ?

update page_data
set p_content = replace(convert(nvarchar(4000), p_content), 'hspace="0"', '') where p_page_id = 73
 
I don't know...what did BOL say about the use of ntext with Replace?
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top