Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

create multiple (2) auto Increment fields in a table

Status
Not open for further replies.

tjock

Programmer
Nov 9, 2001
9
0
0
US
How do you create multiple (2) auto Increment fields in a table?
SQL defaults to only want 1, and assumes it's the identity seed.
 
MS only allows 1 identity column per table.

You can take care of it by adding a trigger and updating the new field yourself. You might maintain your own transaction ID's using a separate table that held the incremental counts of each transaction type.
More info if needed.

MikeD
 
If its an aou increment surely it will be the same as the first.
Why do you require this?
Can't you use the first one in both cases?
 
Thanks - the reason I want to do create the additional auto-incremeted field to generate random integer or varchar fields which will serve as passwords. This may sound somewhat clugy, but seems to be the quickest/easiest way to assign simple passwords to 100+ records. So I can't really use the first one (id) for both - ideally it would be at least a 4 digit field. I obviously don't live in sql, am pretty new so pardon me asking what if "aou" is the same thing as Auto Incremented identity seed, or something else?
 
NorthChert,

1) Please post new questions in a new thread.
2) The documentation for SQL Server is called SQL Books Online or SQL BOL. Open the documentation to the topic "Create Trigger." Read faq183-689- "What are SQL Books Online & Where Can I Find Them?" Terry L. Broadbent - DBA
SQL Server Page:
If you want to get the best answer for your question read faq183-874.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top