Solved

Setting a column's datatype to autonumber

Posted on 2000-05-17
2
494 Views
Last Modified: 2006-11-17
I have noticed that in Access RDBMS you are able to set the data-type of a column to autonumber which then automatically assigns a unique identifying number to each row. Is there an equivalent SQL command for a database such as mySQL?
0
Comment
Question by:ubya308
2 Comments
 
LVL 1

Accepted Solution

by:
rickbus101 earned 100 total points
ID: 2816682
Yes, it's the identity property with seed and increment values.

Here's the sql:

create table tablename
 (fieldname int identity (1, 10))

1 is the seed value and 10 is the increment value.

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2816703
If you want other UniqueIdentifier as datatype (that 128 byte long GUID), you may assign the Default value of the column to NEWID()

create table tablename
 (fieldname uniqueidentifier DEFAULT NEWID())
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Oracle DB monitor SW 21 48
SQL Server Count where two id types exist in column 8 27
SQL Help 27 43
SQL View nearest date 5 35
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question