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

前端 未结 13 1418
醉梦人生
醉梦人生 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:53

    Logically speaking Rohit's solution should have worked, but it didn't. I think SQL Management Studio messed up when trying to optimize this.

    But by modifying the string before comparing them I was able to get the right results. This worked for me:

    SELECT [ExternalId]
    FROM [EquipmentSerialsMaster] where LOWER('0'+[ExternalId]) COLLATE Latin1_General_CS_AS != '0'+[ExternalId]
    

提交回复
热议问题