the primary key should not be nil and it should be integer as well.

if you want them all be unique then  change you creation script

create table hedge (hedge_id integer primary key autoincrement , hedge_name text)

And change you insert statements as follow

insert into hedge ( hedge_name) values ('around');
.......

Here is documentation for you :

"

Specifying a PRIMARY KEY normally just creates a UNIQUE index on the corresponding columns. However, if primary key is on a single column that has datatype INTEGER, then that column is used internally as the actual key of the B-Tree for the table. This means that the column may only hold unique integer values. (Except for this one case, SQLite ignores the datatype specification of columns and allows any kind of data to be put in a column regardless of its declared datatype.) If a table does not have an INTEGER PRIMARY KEY column, then the B-Tree key will be a automatically generated integer. The B-Tree key for a row can always be accessed using one of the special names "ROWID", "OID", or "_ROWID_". This is true regardless of whether or not there is an INTEGER PRIMARY KEY. An INTEGER PRIMARY KEY column man also include the keyword AUTOINCREMENT. The AUTOINCREMENT keyword modified the way that B-Tree keys are automatically generated. Additional detail on automatic B-Tree key generation is available separately <autoinc.html>."




[EMAIL PROTECTED] wrote:

I'm not seeing what must be obvious, so fresh eyes would be very helpful.
When I try -- from the command line:

                      sqlite3 foo.db < load_hedges.sql

the following error is reported:

                      SQL error: 1 values for 2 columns

I get the same error even when I explicitly put an ID int in the values.
Why?

  Here's the file:

create table hedge (hedge_id integer primary key, hedge_name text);

insert into hedge (hedge_id, hedge_name) values ('around');
insert into hedge (hedge_id, hedge_name) values ('slightly');
insert into hedge (hedge_id, hedge_name) values ('not');
insert into hedge (hedge_id, hedge_name) values ('near');
insert into hedge (hedge_id, hedge_name) values ('positively');
insert into hedge (hedge_id, hedge_name) values ('above');
insert into hedge (hedge_id, hedge_name) values ('after');
insert into hedge (hedge_id, hedge_name) values ('before');
insert into hedge (hedge_id, hedge_name) values ('below');
insert into hedge (hedge_id, hedge_name) values ('generally');
insert into hedge (hedge_id, hedge_name) values ('vicinity');
insert into hedge (hedge_id, hedge_name) values ('very');
insert into hedge (hedge_id, hedge_name) values ('somewhat');
insert into hedge (hedge_id, hedge_name) values ('extremely');
insert into hedge (hedge_id, hedge_name) values ('about');
insert into hedge (hedge_id, hedge_name) values ('close');

Puzzled,

Rich



--

-- Mark Pirogovsky

"Computers made it possible to make millions mistakes a second"
"Ask no questions and hear no lies"

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to