Solved

Setting a column's datatype to autonumber

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

863 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

26 Experts available now in Live!

Get 1:1 Help Now