AutoNumber Vs Number
Question
Language: DataBase.
Program: Microsoft Access.
Question: When creating new tables. What is a good practice to use
AutoNumber
and what is a good practice to use Number
? In other words, when is it better to use which? I know the differences but I am just not sure how that would effect implementation when using a programming language like C# to read/write in/to the database.
Feel free to go in as many details and view this in different angles if you like to. The more info I can get the better.
Thank you.3 Replies
Here is an example of my case:
Let's say, for simplicity, we have a table named
Animal
with the fields:
. ID is the primary key.
. ID doesn't have a real meaning to the animal, it is just a field for uniqueness of row.
. Rest of the fields are not required and may be empty.
Now let's say we are using a programming language to insert a new row. (In my case it will be C#)
The only information we know is the weight of the animal.
In our query, this can be done in one of these methods:
1- Insert only weight (MS Access will automatically fill the rest)
2- Insert all data, put NULLs explicitly to where it is not specified.
Here is the thing, if you choose Number/AutoNumber, you may have to insert all data, including null ones, like method 2
. This is a bit of an issue for performance.hi sorry for late reply
i use auto numbers in ms sql
go with auto number
Hi Furkan, no worries thanks a lot of replying. I thought I already closed this thread tho. I got a few answers that satisfied me. Seems like AutoNumber was the way to go.