?
Solved

syntax error on sql ... too long.

Posted on 2009-12-30
2
Medium Priority
?
212 Views
Last Modified: 2012-05-08
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
0
Comment
Question by:Aleks
2 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 26147215
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
 
LVL 13

Expert Comment

by:sameer2010
ID: 26147356
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question