Get rid of the quotes in your values. sqlite> create table t2(n integer check(typeof(n)='integer')); sqlite> insert into t2 values('5'); Error: constraint failed sqlite> insert into t2 values(5); sqlite> select n from t2; 5 Michael D. Black Senior Scientist Northrop Grumman Mission Systems
________________________________ From: sqlite-users-boun...@sqlite.org on behalf of Alexey Pechnikov Sent: Thu 4/29/2010 8:25 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] CHECK constraints and type affinity Yes, I did understand. But how we can resolve this situation without manual types casting? Now datatyping working correct only with manual casting but it's hard to use: sqlite> CREATE TABLE T2 (N INTEGER CHECK(TYPEOF(N) = 'integer')); sqlite> INSERT INTO T2 VALUES('5'); Error: constraint failed sqlite> INSERT INTO T2 VALUES(CAST('5' AS INTEGER)); 2010/4/29 Igor Tandetnik <itandet...@mvps.org>: > I wasn't proposing this as a solution. It was an experiment, an attempt to > illustrate what was going on. I though I made it clear - I even show that > negative values slip through this check ('q' would pass the original check, > too). I can only assume you haven't actually read my message before jumping > in to respond. -- Best regards, Alexey Pechnikov. http://pechnikov.tel/ _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users