Return rows where first character is non-alpha Return rows where first character is non-alpha sqlite sqlite

Return rows where first character is non-alpha


Are you going first character only?

select * from TestTable WHERE substr(TestNames,1) NOT LIKE '%[^a-zA-Z]%'

The substr function (can also be called as left() in some SQL languages) will help isolate the first char in the string for you.

edit:Maybe substr(TestNames,1,1) in sqllite, I don't have a ready instance to test the syntax there on.

Added:

select * from TestTable WHERE Upper(substr(TestNames,1,1)) NOT in ('A','B','C','D','E',....)

Doesn't seem optimal, but functionally will work. Unsure what char commands there are to do a range of letters in SQLlite.

I used 'upper' to make it so you don't need to do lower case letters in the not in statement...kinda hope SQLlite knows what that is.


try

SELECT * FROM TestTable WHERE TestNames NOT LIKE '[^a-zA-Z]%'


SELECT * FROM NC_CRIT_ATTACH WHERE substring(FILENAME,1,1) NOT LIKE '[A-z]%';SHOULD be a little faster as it isA) First getting all of the data from the first column only, then scanning it.B) Still a full-table scan unless you index this column.