MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 16th, 2004, 09:26 PM
deanlaw deanlaw is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 deanlaw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Error when using Replace and Update

I am trying to replace the carriage returns and line feeds from a varchar field with a <br> tag using the following query:

UPDATE tmpJobImport
SET job_desc = replace (replace(job_desc, char(10),''), char(13), '<br>')

I receive an error that says "string or binary data would be truncated" and cannot update the field. The field is large enough to hold the update and I can run the exact command in a select statement and get the results back.

SELECT REPLACE(REPLACE(job_desc, CHAR(10), ''), CHAR(13), '<br>') AS testField
FROM tmpJobImport

Any thoughts on why I might be getting this error? I can run the update with just a '<>' or 'br', but not '<br>'.

Thanks,

Dean

Reply With Quote
  #2  
Old June 22nd, 2004, 11:02 PM
brightlight brightlight is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 371 brightlight User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 h 32 m 27 sec
Reputation Power: 5
Hi,

What is the datatype of job_desc?

You get this error because <br> might take extra space than the ordinary string.

Try changing the width of the job_desc and execute it again.
__________________
Regards,
Brightlight

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Error when using Replace and Update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway