create two different id columns in a single table in sql

how to create two different id columns in the same table of sql. i am trying to create by setting identity specification property from sql server management studio.. it is working fine if i have only one id column.. but when i try to create another then the first one's "identity specification" property automatically sets to false... please help me to create both the columns...
Posted by Harpreet 3/23/2014 11:01:44 PM
Total Answers : 1
Answer 1
It is not possible to create two id columns in a single talbe practically. But i will show you the trick. Just use the below query
create table pins
(

cust_id int not null
,pin as reg_cust_id * 789 + 7598755
,pin_id int identity(789452,198789) not null primary key
,transferee_id int null
,transferee_date datetime null

)
Above query create two id columns "pin" and "pin_id".
Keep Coding and stay in touch with SetpCoder.com.
Posted by StepCoder Team 3/25/2014 6:35:09 PM
Post your answer
Preview
Sign in to your account
Your Email : 
Password :   
Forgot your password
Don't have StepCoder account ?
Create a new account
 
Follow me on twitter
About Me
Harpreet Singh
I began programming with C++ when i was 17. Then at the middle of my study .NET came. Then I began to read C# and VB.NET. By the time i learnt SQL and ASP.NET, and developed some websites such as news portals that are active now. Currently i am running my own Software company.
Answer these questions! If you know the answer.