Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Replacing Special Characters

Author  Topic 

Richard Steele
Starting Member

11 Posts

Posted - 2002-09-22 : 08:08:41
I have a nasty little character (I believe it is ascii 11) peppered throughout a SQL table column called collection.
I'd like to replace all instances with a comma and space, and have tried the following code:

UPDATE GuidePhotographers
SET Collection = REPLACE(Collection, ' ', ', ')

Upon execution of the above, I receive a String or binary data would be truncated error message and it fails to run.

I've also tried:
UPDATE GuidePhotographers
SET Collection = REPLACE(Collection, char(11), ', ') and I get the same error message.

Any clues as to how to get this to work would be greatly appreciated. Thanks in advance.

Richard Steele
Starting Member

11 Posts

Posted - 2002-09-22 : 08:11:55
Sorry that character, which looks like a small box, did not appear in my previous post. It is the symbol for an end of paragraph mark.

Any ideas?

Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-09-22 : 08:26:49
You're replacing a single character with 2 characters, and the additional length is probably exceeding the maximum length for that column. You might have to alter the column to accept more characters (see ALTER TABLE in Books Online for the syntax) or only replace that character with another, single character.

Go to Top of Page

Richard Steele
Starting Member

11 Posts

Posted - 2002-09-22 : 11:56:23
That was it! Thanks so much.

Go to Top of Page
   

- Advertisement -