Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
On Sun, Jul 11, 2010 at 02:15:09PM -0400, Igor Tandetnik scratched on the wall: > Jay A. Kreibich wrote: > > You can't add a CHECK constraint to an existing table. > > You should be able to do it by directly updating sqlite_master table: > > http://old.nabble.com/Any-workarounds-suggestions-fo

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
On Sun, Jul 11, 2010 at 07:51:18PM +, c...@comcast.net scratched on the wall: > Creating a new db with the added constraint is not  problem for me > at this time. > If I wanted to allows only values "yes" or "no" or "maybe" in the > recommendation column would I do it like this when I creat

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread ca44
r(4) CHECK(recommendation='yes' | recommendation='no' | recommendation='maybe' ) Thanks in advance -Chris - Original Message - From: "Jay A. Kreibich" To: "Jay A. Kreibich" Cc: "General Discussion of SQLite Database"

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Igor Tandetnik
Jay A. Kreibich wrote: > You can't add a CHECK constraint to an existing table. You should be able to do it by directly updating sqlite_master table: http://old.nabble.com/Any-workarounds-suggestions-for-dropping-a-not-null-constraint--td27439289.html It would probably be prudent to first mak

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
On Sun, Jul 11, 2010 at 09:12:09AM -0500, Jay A. Kreibich scratched on the wall: > On Sun, Jul 11, 2010 at 01:45:50PM +, c...@comcast.net scratched on the > wall: > > > I would like to restrict the values that are entered into > > the "recommendation" column. > > > > How would I state that

Re: [sqlite] restricting values allowed in a column

2010-07-11 Thread Jay A. Kreibich
On Sun, Jul 11, 2010 at 01:45:50PM +, c...@comcast.net scratched on the wall: > I would like to restrict the values that are entered into > the "recommendation" column. > > How would I state that at the time I create the column in that table? Using a CHECK constraint. > Since that tabl

[sqlite] restricting values allowed in a column

2010-07-11 Thread ca44
I have a table schema that looks like this: _ID integer primary key autoincrement name varchar(40) category varchar(40) recommendation varchar(40) I would like to restrict the values that are entered into the "recommendation" column. How would I state that at the time I create the