Solved

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

Posted on 2011-09-26
3
244 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Gettg error - Please help Msg 252, Level 16, State 1, Line 1 3 35
convert null in sql server 12 65
SSRS 2013 - Finding Datasets/StoredProcedures 4 51
SQL query 7 45
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 …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…

736 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