syntax error on sql ... too long.

I have the following code to update a table. It is an nvarchar (1500) field. When i run it i get an error.

SQL Code:

update activities
set partylist = replace (partylist,  "certifications are accredited</a><a href='http://tests4all.org/3/'>free quit smoking tool</a><a href='http://tests4all.org/4/'>the bluest eyes in texas paraody</a><a href='http://tests4all.org/5/'>sayings cheated off the rode</a><artner parts</a><a href='http://tests4all.org/8/'>printable kids iq test</a><a href='http://tests4all.org/9/'>c liv", '' )


Error:

Msg 103, Level 15, State 4, Line 2
The identifier that starts with 'certifications are accredited</a><a href='http://tests4all.org/3/'>free quit smoking tool</a><a href='http://tests4all.org/4/'>t' is too long. Maximum length is 128.

What to do ?

A
LVL 1
AleksAsked:
Who is Participating?
 
Aneesh RetnakaranDatabase AdministratorCommented:
SET QUOTED_IDENTIFIER OFF
update activities
set partylist = replace (partylist,  "certifications are accreditedfree quit smoking toolthe bluest eyes in texas paraodysayings cheated off the rodeprintable kids iq testc liv", '' )
0
 
sameer2010Commented:
Try this
declare @updtString varchar(1500);
SET QUOTED_IDENTIFIER OFF
set @updtString = "certifications are accredited</a><a href='http://tests4all.org/3/'>free quit smoking tool</a><a href='http://tests4all.org/4/'>the bluest eyes in texas paraody</a><a href='http://tests4all.org/5/'>sayings cheated off the rode</a><artner parts</a><a href='http://tests4all.org/8/'>printable kids iq test</a><a href='http://tests4all.org/9/'>c liv";

update activities
set partylist = replace(partylist,@updtString, '' ) 

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.