T
Tim Ward
Table with just one column which is an autonumber column - how do I insert
records?
records?
Like any other insert command:Table with just one column which is an autonumber column - how do I
insert records?
Tim Ferguson said:Like any other insert command:
INSERT INTO MyTable (MyANcolumn)
VALUES (1024)
but why would you want to..?
TC said:I think he means manually, from the UI. He has opened the table
datasheet. How does he add new records to it (manually)?!
Tim Ferguson said:Ummm.... why would he want to?
What about pressing <tab> whilst the focus is on the autonumber field of
the "new record" row...
Tim Ferguson said:Like any other insert command:
INSERT INTO MyTable (MyANcolumn)
VALUES (1024)
but why would you want to..?
content?Van T. Dinh said:The only purpose of an AutoNumber Field is to provide uniqueness to each
Record in the Table. Thus, the Table with only the AutoNumber Field does
not have any useful information content.
Why would you want to create the Table without any meaningful info.
Van T. Dinh said:So you have another Field in this Table which is a ForeignKey Field???
Tim Ward said:content?
Because the only attribute of this object is a multivalued attribute, so the
actual information is in a join table which refers back to this main table
via a foreign key.
Van T. Dinh said:Actually, you can't, even with Tab key. You need to enter something (in
another Field) for the AutoNumber Field value to be assigned.
TC said:But surely you want to store some non-key attributes of the object
represented by the main table? I'm not arguing that you are incorrect. I
just can't think of a case where I would want to store child details of a
parent object, but I did >not< need any non-key attributes of that parent
object!
Tim Ward said:No, there are no non-key attributes of the object represented by the main
table. The main table is a table of "lists of widgets", each row
representing one (possibly empty) "list of widgets". There is no information
associated with a "list of widgets" other than the id and the widgets.
(Yes, there is information about who owns which list of widgets, but
different lists of widgets can be owned by different types of objects in a
tree structure, and I've chosen the pattern which has "list of widget" id
fields in the owning objects' tables rather than the pattern which has "type
of owner" and "id of owner" fields in the "list of widget" table. Both
solultions are admittedly mucky, but I've got reasons for claiming the one
I've chosen is slightly less mucky in this particular application.)
Tim Ward said:No, there are no non-key attributes of the object represented by the main
table. The main table is a table of "lists of widgets", each row
representing one (possibly empty) "list of widgets". There is no information
associated with a "list of widgets" other than the id and the widgets.
(Yes, there is information about who owns which list of widgets, but
different lists of widgets can be owned by different types of objects in a
tree structure, and I've chosen the pattern which has "list of widget" id
fields in the owning objects' tables rather than the pattern which has "type
of owner" and "id of owner" fields in the "list of widget" table. Both
solultions are admittedly mucky, but I've got reasons for claiming the one
I've chosen is slightly less mucky in this particular application.)
If you do an insert and specify a number, it actually uses that number:
INSERT INTO(testcol) values (0)
Puts an entry with 0 as the "Autonumber" field.
to the reader to find out how Jet treats NULL+1 as a numeric value.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.