Shijin Shijin - 1 year ago 97
SQL Question

Search text containing a new line in MySQL

I have a MySQL table that stores a large number of products. By some mistakes i added some of the product name with a new line. I need to find them. The bellow query is not listing all of the expected data.

SELECT * FROM `products` WHERE `product_name` REGEXP "\r\n";

Answer Source

It depend of way what you use to new line. Different text editor programs use different way to write new line.

Try to use only "\n" or combinations of "\r" and "\n".

For me worked this:

  SELECT * FROM `products` WHERE `product_name` REGEXP "\n";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download