473,386 Members | 1,745 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,386 software developers and data experts.

AutoNumber

114 100+
Guys, recently i have transferred by Access database to sql server 2000 n in a process of upgrading the application too. i m using VB6. well i had tables whose id was an "AutoNumber" in ms access. now when it is converted to sql server it is of integer data type. I just wanna know that is there a data type like the AutoNumber in SQL server too. Does the Uniqueidentifier data type in sql server have the same function as the autonumber in ms access? Or else what is the standard followed to achieve such a task (to generate a unique id for each rows in a table automatically)
Feb 19 '08 #1
6 1743
debasisdas
8,127 Expert 4TB
1.before inserting the record findout the count.
2.increment that value by 1 and use for the next row.
Feb 19 '08 #2
raaman rai
114 100+
1.before inserting the record findout the count.
2.increment that value by 1 and use for the next row.
yes dude, thats a gud idea but r u sure this is da standard that u all follow? Plus do u mean 2 say there is no alternatives other than this?
Feb 19 '08 #3
ck9663
2,878 Expert 2GB
Try the IDENTITY data type.

Again, it assures uniqueness, not sequence. If you delete a row, that value of your IDENTITY field will not be reuse.

-- CK
Feb 19 '08 #4
raaman rai
114 100+
Try the IDENTITY data type.

Again, it assures uniqueness, not sequence. If you delete a row, that value of your IDENTITY field will not be reuse.

-- CK
thank u dude, i recently came across this but i must say since my table is already with data i cannot create a new table. So, in this case i cannot find the type IDENTITY in the data type column when i try to change the table properties. What does it mean?
Feb 20 '08 #5
ck9663
2,878 Expert 2GB
If you can not recreate the table, you can insert a new column of int data type. At the bottom part of the window, change the Identity to "Yes". The seed is the first value that it will use. The increment is how do you want this Autonumber to increment (by 1s, 2s, etc).

-- CK
Feb 20 '08 #6
raaman rai
114 100+
If you can not recreate the table, you can insert a new column of int data type. At the bottom part of the window, change the Identity to "Yes". The seed is the first value that it will use. The increment is how do you want this Autonumber to increment (by 1s, 2s, etc).

-- CK
Thanks guys, u all have been a gr8 help 2 me. well i got the clue n succeded. thanks once again
Feb 20 '08 #7

Sign in to post your reply or Sign up for a free account.

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: 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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.