Home:ALL Converter>Adding auto-incremented values to a table with one column

Adding auto-incremented values to a table with one column

Ask Time:2011-10-24T23:53:07         Author:user1011201

Json Formatter

I need to create a table that basically keeps a list of indices only. Therefore I've created a table with just one, auto-incremented column called 'id'. However, I can't seem to implicitly add auto-incremented values to this table.

I know that usually when you have such a column in a table (with more than just this column) you can do:

INSERT INTO TABLE (col1, col2 ...) VALUES (val1, val2 ...)

And if you don't specify the auto-incremented column, it would automatically get a value. However, things like:

INSERT INTO TABLE () VALUES () INSERT INTO TABLE INSERT INTO TABLE ()

etc. all produce an error on my single-columned table. Can anyone offer a solution? Thanks.

p.s. I'm using Sqlite, in case it matters.

Author:user1011201,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7878369/adding-auto-incremented-values-to-a-table-with-one-column
Sparky :

Try this\n\nINSERT INTO dbo.Table DEFAULT VALUES \n\n\nSee this answer:\nPrevious answer",
2011-10-24T15:56:33
yy