Finding a line break in a text string in a SQL table?

前端 未结 4 1361
遇见更好的自我
遇见更好的自我 2021-02-11 14:25

I was trying to find line breaks and carriage returns in a column in a SQL table and I am not sure about the syntax.

I tried:

SELECT foo FROM test
WHERE          


        
相关标签:
4条回答
  • 2021-02-11 14:28

    Try

    SELECT foo FROM test WHERE foo LIKE CONCAT('%', CHAR(10), '%')
    
    0 讨论(0)
  • 2021-02-11 14:42

    Try

      SELECT foo FROM test WHERE foo LIKE '%'+ CHAR(10)+'%'
    
    0 讨论(0)
  • 2021-02-11 14:43
    SELECT foo FROM Table WHERE foo LIKE '%' + CHAR(13)+CHAR(10) + '%'
    
    0 讨论(0)
  • 2021-02-11 14:47
    SELECT foo FROM test WHERE foo LIKE '%' + CHAR(10) + '%'
    

    Edit: to find all various types of line endings you should probably just check both:

    SELECT foo FROM test WHERE foo LIKE '%' + CHAR(10) + '%'
                            OR foo LIKE '%' + CHAR(13) + '%'
    
    0 讨论(0)
提交回复
热议问题