regex - SQL Server 2008: How to select all rows where field has all capital letters? -


here thinking, know in field, first word @ least 2 characters long.

select *   table! substring(name, 1, 3) '[a-z]' 

however, bringing non capital letters ideas?

select ... mytable name not '%[^a-z]%' collate sql_latin1_general_cp1_cs_as 

it should noted exclude numbers , characters outside a-z. if wanted non-latin upper case characters included, need use upper function along collate predicate:

select ... mytable name = upper(name) collate sql_latin1_general_cp1_cs_as 

test script:

with testdata     (     select '012324' name     union select 'abc'     union select 'abc'     union select 'abc'     union select 'abé'     union select 'abÉ'     ) select * testdata name = upper(name) collate sql_latin1_general_cp1_cs_as 

results:

012324 abc abÉ 

Comments