Solved

Add more than one auto-incremental field in SQL Server table

Posted on 2011-09-26
3
237 Views
Last Modified: 2012-08-13
Hi

we have a table called Table1 and it has a primary key IDTable1 which is an auto-incremental field. we want to make another field as an auto-incremental field too. is it possible to do that, because it sounds like you can only make one auto-incremental at a time in SQL Server table.

How we can do this with SQL instructions by :
Alter Table bla bla bla .......

Thanks  
0
Comment
Question by:venmarces
3 Comments
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 250 total points
ID: 36602517
no you can only have 1 identity column per table

why do you think you need a second?
0
 
LVL 32

Assisted Solution

by:bhess1
bhess1 earned 250 total points
ID: 36602607
You can mock up auto-incrementing fields using triggers, but you can not use more than one identity field (which is the auto incrementing field type) in a single table.  How you mock up another incrementing field depends on what you want to do with it.  

So, please specify what it is you wish to accomplish.
0
 

Author Closing Comment

by:venmarces
ID: 36981261
good
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

20 Experts available now in Live!

Get 1:1 Help Now