SQLite, check if TEXT field has any alphabetical chars in it

半世苍凉 提交于 2019-12-05 08:23:05

You can use GLOB in SQLite with a range to single them out:

SELECT * 
FROM MY_TABLE
WHERE num GLOB '*[A-Za-z]*'

See it in use with this fiddle: http://sqlfiddle.com/#!7/4bc21/10

For example, for these records:

   num
----------
1234567890
0987654321
1000000000
1000A00000
1000B00000
1000c00000

GLOB '*[A-Za-z]*' will return these three:

   num
----------
1000A00000
1000B00000
1000c00000

You can then translate that to the appropriate DELETE:

DELETE 
FROM MY_TABLE
WHERE num GLOB '*[A-Za-z]*'
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!