2

I have the following table:

create table indices (
id int primary key generated by default as identity
);

how do I insert a new row?

I have already tried several things I have found, like:

insert into indices values (null);
insert into indices default values;

however that didn't work with derby.

2
  • First question pops to mind. Why? Feb 10, 2011 at 9:09
  • i have another table that references the id this table. it is a work in progress but i war curious how that works.
    – suicide
    Feb 10, 2011 at 9:17

2 Answers 2

2

Try "insert into indices values (default)"

0
0

You need a column to insert into. You have id which is an identity, which means it will already have a value when a new row is inserted. Add a new column and then fill that column in your insert statement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.