How to create table with auto increament field

Posted on 2000-03-27
Last Modified: 2012-08-13
How to create table with auto increament field like in MS-Acccess

Question by:Dewi
  • 2
  • 2

Accepted Solution

crsankar earned 50 total points
ID: 2660293
create table abc
(col1 numeric identity(1,1))

Note that when you use identity the column should not allow decimal values


where seed is the starting value
increment is how much to increment by each time
LVL 10

Expert Comment

ID: 2660316
What type of database is it? Is it an MS-Access database or another one?

Some databases do not support auto-increment fields.

Expert Comment

ID: 2662710
Since it is posted in the sql-server section I am assuming that you are talking about a sql server database.
LVL 10

Expert Comment

ID: 2663122
Sorry, I came into this question after a redirection from elsewhere. I wasn't aware it was in the SQL server area....

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Pivot table 2 42
SCOM to SQL port 14xx failed? 1 30
SQL Get Store Procedure Column Name As Row 5 39
Find special characters using tSQL 6 15
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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.
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
Via a live example, show how to shrink a transaction log file down to a reasonable size.

756 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