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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 2 identity columns in a table?

Author  Topic 

PeterG
Posting Yak Master

156 Posts

Posted - 2001-11-23 : 16:57:13
How can I have two id columns in a table. I know it's stupid to have two, but I need the other field to be unique too. When a user is added to the table, the first id and the scond id must be incremented by 1, although they have different id seed (one starts at 1 and the other at 10000).

nr
SQLTeam MVY

12543 Posts

Posted - 2001-11-25 : 20:30:50
If the two are just 10000 apart then you don't need to store both.
The redundent value can be created in the stored proc.

You could also create a view (I don't recommend this) to access the table which generates the second value.

computed columns are also available in v7.



==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -