How can I check if an SQL result contains a newline character?
SELECT *
FROM your_table
WHERE your_column LIKE '%' + CHAR(10) + '%'
Or...
SELECT *
FROM your_table
WHERE CHARINDEX(CHAR(10), your_column) > 0
For any fellow MySQL users who end up here:
SELECT *
FROM your_table
WHERE your_column LIKE CONCAT('%', CHAR(10), '%')
In Oracle, try the below command
SELECT * FROM table_name WHERE field_name LIKE ('%'||chr(10)||'%');
Use char(13)
for '\r'
and char(10)
for '\n'
SELECT *
FROM your_table
WHERE your_column LIKE '%' + CHAR(10) + '%'
or
SELECT *
FROM your_table
WHERE your_column LIKE '%' + CHAR(13) + CHAR(10) + '%'