Home All Groups Group Topic Archive Search About

Getting rid of unwanted characters!

Author
29 Jul 2005 3:17 AM
KB
Hello Gurus, I’ve a table that has a column with a text data type. When they
imported the data from a different system some non ASCII character slipped
into the table. What would be the best way to get rid of them?

For example:  A man ne£ds  ₤∂help.   to     A man needs help
thanks in advance.

Author
29 Jul 2005 7:52 AM
John Bell
Hi

If this is a one off, you may want to try:

UPDATE myStrings
SET str = STUFF(str,PATINDEX('%[^A-Z ]%',str),1 ,'')
WHERE PATINDEX('%[^A-Z ]%',str) > 0

WHILE @@ROWCOUNT > 0
BEGIN
    UPDATE myStrings
    SET str = STUFF(str,PATINDEX('%[^A-Z ]%',str),1 ,'')
    WHERE PATINDEX('%[^A-Z ]%',str) > 0
END

John

Show quote
"KB" wrote:

> Hello Gurus, I’ve a table that has a column with a text data type. When they
> imported the data from a different system some non ASCII character slipped
> into the table. What would be the best way to get rid of them?
>
> For example:  A man ne£ds  ₤∂help.   to     A man needs help
> thanks in advance.
>
Author
29 Jul 2005 12:48 PM
Aaron Bertrand [SQL Server MVP]
http://www.aspfaq.com/2445




Show quote
"KB" <K*@discussions.microsoft.com> wrote in message
news:F11D992A-CC05-4776-B43A-A3AB8412F291@microsoft.com...
> Hello Gurus, I’ve a table that has a column with a text data type. When
> they
> imported the data from a different system some non ASCII character slipped
> into the table. What would be the best way to get rid of them?
>
> For example:  A man ne£ds  ₤∂help.   to A man needs help
> thanks in advance.
>
Author
29 Jul 2005 10:13 PM
KB
Great Help! Thank you gentlemen.

Show quote
"KB" wrote:

> Hello Gurus, I’ve a table that has a column with a text data type. When they
> imported the data from a different system some non ASCII character slipped
> into the table. What would be the best way to get rid of them?
>
> For example:  A man ne£ds  ₤∂help.   to     A man needs help
> thanks in advance.
>

AddThis Social Bookmark Button