REPLACE function in Mysql is used to replace specified string or char. Similarly we can replace a NEWLINE char '\n' in a string with any of our choice.
Syntax
SELECT REPLACE(,'\n',' ') from
Example : Lets say column Message of Students table has a text of below type
Message
-----------------------------
Hello, Good Morning
All are having test tomorrow
In the above column value has a newline after Good morning, if we want to replace the newline by space we have to use the command as mentioned below.
SELECT REPLACE(Message,'\n',' ') Message from Students
The output would be
Message
-----------------------------
Hello, Good Morning All are having test tomorrow
Comments (0)