On 11/24/2015 6:07 PM, Richard Hipp wrote:
> On 11/24/15, James Hartley <jjhartley at gmail.com> wrote:
>> I would like to add a check constraint which determines if a string
>> contains all digits, ie.
>>
>> sqlite> select zip_code from zip_codes where regexp(zip_code,
>> '^[[:digit:]]+$');
>>
>> However, this generates the error:
>>
>> Error: no such function: regexp
>
> Maybe this instead:
>
>     SELECT * FROM zip_codes WHERE zip_code NOT GLOB '[^0-9]';

Another variation: WHERE ltrim(zip_code, '0123456789')=''
-- 
Igor Tandetnik

Reply via email to