473,385 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Autonumber

What is the equivelant to Autonumber coming from an Access World to
SQL?
TIA

Michael
Jul 20 '05 #1
8 11601

"Michael" <Mi***@yahoo.com> wrote in message
news:9h********************************@4ax.com...
What is the equivelant to Autonumber coming from an Access World to
SQL?

IDENTITY


TIA

Michael

Jul 20 '05 #2
> What is the equivelant to Autonumber coming from an Access World to
SQL?
A proper primary key.

http://www.sqlteam.com/item.asp?ItemID=2599

--
David Portas
------------
Please reply only to the newsgroup
--

"Michael" <Mi***@yahoo.com> wrote in message
news:9h********************************@4ax.com... What is the equivelant to Autonumber coming from an Access World to
SQL?
TIA

Michael

Jul 20 '05 #3
On Sun, 30 Nov 2003 23:56:37 GMT, "Greg D. Moore \(Strider\)"
<mo*****@greenms.com> wrote:

R U referring to uniqueidentity

"Michael" <Mi***@yahoo.com> wrote in message
news:9h********************************@4ax.com.. .
What is the equivelant to Autonumber coming from an Access World to
SQL?


IDENTITY


TIA

Michael


Jul 20 '05 #4
On Mon, 01 Dec 2003 03:46:21 GMT in comp.databases.ms-sqlserver,
Michael <Mi***@yahoo.com> wrote:
On Sun, 30 Nov 2003 23:56:37 GMT, "Greg D. Moore \(Strider\)"
<mo*****@greenms.com> wrote:

R U referring to uniqueidentity


No, that's a GUID, make it an "Int" data type and set the "Identity"
property to "yes"

--
A)bort, R)etry, I)nfluence with large hammer.
Jul 20 '05 #5
On Mon, 1 Dec 2003 00:08:13 -0000 in comp.databases.ms-sqlserver,
"David Portas" <RE****************************@acm.org> wrote:
What is the equivelant to Autonumber coming from an Access World to
SQL?
A proper primary key.

http://www.sqlteam.com/item.asp?ItemID=2599


hmmm, I use identity columns, their meaningless is nothing to me, I
don't let users see them or touch them, they mean an awful lot to the
computer though :-)

From that page:using only the ID and BossID columns, identify each person's boss. Can't do it, huh?


This assumes you display raw data to the user, in reality you join
tables and make menaingful presentation data to show the user.

In the second table, the candidate is easy, the URL will be unique
although imagine you've exported to another system, then import data
back from that, one or more of your meaningful PKs was misspelled and
corrected in the meantime, there would not be a match when the data
comes back in.

--
A)bort, R)etry, I)nfluence with large hammer.
Jul 20 '05 #6
My point was not that the OP should necessarily avoid IDENTITY altogether
but that he shouldn't assume he can just port an Access database to SQL by
changing an Autonumber column to IDENTITY. In Access you can get away
without primary keys - not always so in SQL.

It may be reasonable to use IDENTITY as a *surrogate* key but if you don't
have a natural key as well then you can't define the entity for the table
and it may contain redundant data. Consider:

CREATE TABLE foo (id INTEGER IDENTITY PRIMARY KEY /* ? */, a INTEGER NOT
NULL, b INTEGER NOT NULL, c INTEGER NOT NULL)

If (a,b,c) are your attributes then why would they not be unique? What's the
point of storing the same information multiple times? Clearly Id isn't an
attribute of you entity so ([1],x,y,z) and ([2],x,y,z) are redundant tuples.
This is the best way to fill up your table with garbage and make life very
difficult when it comes to joins and other queries.

--
David Portas
------------
Please reply only to the newsgroup
--
Jul 20 '05 #7
On Tue, 2 Dec 2003 10:09:17 -0000 in comp.databases.ms-sqlserver,
"David Portas" <RE****************************@acm.org> wrote:
My point was not that the OP should necessarily avoid IDENTITY altogether
but that he shouldn't assume he can just port an Access database to SQL by
changing an Autonumber column to IDENTITY. In Access you can get away
without primary keys - not always so in SQL.

It may be reasonable to use IDENTITY as a *surrogate* key but if you don't
have a natural key as well then you can't define the entity for the table
and it may contain redundant data. Consider:

CREATE TABLE foo (id INTEGER IDENTITY PRIMARY KEY /* ? */, a INTEGER NOT
NULL, b INTEGER NOT NULL, c INTEGER NOT NULL)

If (a,b,c) are your attributes then why would they not be unique? What's the
point of storing the same information multiple times? Clearly Id isn't an
attribute of you entity so ([1],x,y,z) and ([2],x,y,z) are redundant tuples.
This is the best way to fill up your table with garbage and make life very
difficult when it comes to joins and other queries.


There's nothing to stop you putting a unique index on the other keys.
--
A)bort, R)etry, I)nfluence with large hammer.
Jul 20 '05 #8
> There's nothing to stop you putting a unique index on the other keys.

Yes, as I said:
It may be reasonable to use IDENTITY as a *surrogate* key but if you don't
have a natural key as well then you can't define the entity for the table


Unfortunately this is too often forgotten as posts to this group frequently
demonstrate. See also Northwind for MS's bad examples.

--
David Portas
------------
Please reply only to the newsgroup
--
Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ilan Sebba | last post by:
I have a 'supertype' table with only one field: autonumber. Call this table the 'parent' table. There are two subtypes, 'androids' and 'martians'. Martian have only one thing in common: they give...
33
by: Lee C. | last post by:
I'm finding this to be extremely difficult to set up. I understand that Access won't manage the primary key and the cascade updates for a table. Fine. I tried changing the PK type to number and...
35
by: Traci | last post by:
If I have a table with an autonumber primary key and 100 records and I delete the last 50 records, the next record added would have a primary key of 101. Is there any way to have the primary key...
4
by: yf | last post by:
A KB article "http://support.microsoft.com/default.aspx?scid=kb;en-us;209599" tells that the maximum number of records that a table may hold if the PRIMARY key data type is set to AUTONUMBER is...
26
by: jimfortune | last post by:
Sometimes I use Autonumber fields for ID fields. Furthermore, sometimes I use those same fields in orderdetail type tables. So it's important in that case that once an autonumber key value is...
8
by: petebeatty | last post by:
I have created a SQL string the properly inserts a record in the table. However, the insert does not occur at the end of the table. Instead it inserts a record after the last record that I viewed....
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
1
by: gtwannabe | last post by:
I'm having a problem with a form that uses AutoNumber as the primary key. I have an Abort button to delete the current record and close the form. If AutoNumber is assigned, the code executes a...
9
by: Tom_F | last post by:
To comp.databases.ms-access -- I just discovered, to my more than mild dismay, that some tables in my Microsoft Access 2003 database have duplicate numbers in the "AutoNumber" field. (Field...
6
by: ashes | last post by:
Hi, I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net When someone wants to register on the website, they fill out a form and the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.