Solved

Setting a column's datatype to autonumber

Posted on 2000-05-17
2
492 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now