MySQL Forums
Forum List  »  Newbie

How to replace LF/CR in a SELECT statement
Posted by: Simon
Date: June 16, 2005 02:58AM

Hi,

I'm trying to extract data from mySQL that contains ASCII 10/13 (LF/CR). Unfortunately I can't pre-/post-process the data, so I need to replace these characters (with "<BR/>") within the SELECT statement.

In SQLServer (sorry!) I would do it like this:

SELECT REPLACE( suggestion_text, (chr(10)+chr(13)), "<br/><br/>") AS suggestion_title, suggestion_title, suggestion_author, suggestion_date
FROM newwebsite_ideas
ORDER BY suggestion_date DESC

I tried this in mySQL and got the following error:

"ADO Error # -2147217900 NativeError 1064 Description [MySQL][ODBC 3.51 Driver][mysqld-3.23.49-max-debug]You have an error in your SQL syntax near '(10)+chr(13)), "

Options: ReplyQuote


Subject
Written By
Posted
How to replace LF/CR in a SELECT statement
June 16, 2005 02:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.