Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding line break and carriage return (\r\n) in MySQL

I can't seem to find any info about this on the internet (or I'm just not looking in the right direction).

I have a few fields in my MySQL database containing a carriage return and line break \r\n .

Is there somebody who can tell me how to find them by using a query??

like image 411
Display name Avatar asked Jun 12 '12 12:06

Display name


People also ask

How do I find line breaks in MySQL?

SELECT * FROM mytable WHERE mycolumn REGEXP "\r\n"; finds all records in mytable where mycolumn contains a \r\n sequence. At least in MySQL Workbench for Windows, when I used the " (double quote) from your answer, it was translated into a newline in my query and didn't work. I had to use ' (single quotes.)

How do I find carriage return and line feed in SQL?

Using SQL to remove a line feed or carriage return means using the CHAR function. A line feed is CHAR(10); a carriage return is CHAR(13).

How do I insert a carriage return in MySQL?

-- Using both \r\n SELECT 'First line. \r\nSecond Line. ' AS 'New Line'; -- Using both \n SELECT 'First line.

What is CR LF in SQL?

SQL Carriage Return (CR): The Carriage Return moves the cursor to the beginning of the line. It does not move to the next line. Line feed (LF): The line feed moves the cursor to the next line. It does return to the beginning of the line.


1 Answers

SELECT * FROM mytable WHERE mycolumn REGEXP "\r\n"; 

finds all records in mytable where mycolumn contains a \r\n sequence.

like image 163
Tim Pietzcker Avatar answered Oct 05 '22 15:10

Tim Pietzcker