Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
crugerenator
Posting Yak Master
126 Posts |
Posted - 2007-06-29 : 18:01:52
|
| I know about IDENTITY(x,x), but I already have that for my primary key. I also want to add into the same table a row that auto increments, but without using IDENTITY because it won't let me use IDENTITY more than once per table. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-06-29 : 18:16:46
|
| Why do you need two? Perhaps we can fix your design if you explain why you need this.Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-06-29 : 18:23:59
|
| Yes you can only have one IDentity column per table. IF you need additional ordered numbers, you can either generate at the front end or manually insert them by getting (max +1) or have another table with identity column and get the value from there etc.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2007-07-01 : 14:24:25
|
| Crugerenator...Please explain why you need two autoincrementing columns in the same table. It's the only way folks will be able to figure out what you actually need and why.--Jeff Moden |
 |
|
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2007-07-01 : 15:03:12
|
| you can use instead of insert trigger to do a count sequence to produce the same result |
 |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-07-01 : 16:00:30
|
or, just use a computed column where ComputedColumn = IdentityColumnThatAlreadyExists elsasoft.org |
 |
|
|
crugerenator
Posting Yak Master
126 Posts |
Posted - 2007-07-02 : 09:58:59
|
| I wanted to put a parent_id column into a table that keeps track of customer comments, so a customer could comment on a comment. I solved the problem by just setting the parent_id=comment_id when inserting it into the database. This worked because of how I have the information displayed on my page. |
 |
|
|
|
|
|