How to find rows that have a value that contains a lowercase letter

前端 未结 13 1421
醉梦人生
醉梦人生 2021-02-01 00:36

I\'m looking for an SQL query that gives me all rows where ColumnX contains any lowercase letter (e.g. \"1234aaaa5789\"). Same for uppercase.

13条回答
  •  日久生厌
    2021-02-01 00:43

    SELECT * FROM my_table WHERE my_column = 'my string'
    COLLATE Latin1_General_CS_AS
    

    This would make a case sensitive search.


    EDIT

    As stated in kouton's comment here and tormuto's comment here whosoever faces problem with the below collation

    COLLATE Latin1_General_CS_AS
    

    should first check the default collation for their SQL server, their respective database and the column in question; and pass in the default collation with the query expression. List of collations can be found here.

提交回复
热议问题