Solved

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

Posted on 2011-09-26
3
239 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

864 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

23 Experts available now in Live!

Get 1:1 Help Now