Cecil Westerhof wrote:
> I want to create a field that only has values that consist of letters,
> numbers end '-'. So no spaces, quotes or special characters like: '@%$!'.
> What is the best way to write this check constraint?

The GLOB operator has inverted character classes.  So the field is valid
if its value does not contain any character that is not in the valid list:

CREATE TABLE [] (
  Field  CHECK(Field NOT GLOB '*[^0-9A-Za-z-]*')
);


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to