Click here to Skip to main content
15,905,782 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

I intend to design a form by Asp.net that employees insert their personal information , and then these data to be stored in DB(Sqlserver 2008r2).

in my DB logical design , i had supposed to be:(PersonelCode,Int, pk,unique,not null)
but my problem is : someone told me that PersonelCode datatype shouldn't be Int, because some of them include words, or begin from Zero(example: 0343),
so what shall i do , is it correct to change the datatype to String ? if yes , how can keep it unique and to specify person's identificaion?
Posted
Comments
dimpledevani 26-Jul-12 2:44am    
It is not necessary, every company or firm have their own way of storing such data
mohammad ehsan 26-Jul-12 3:22am    
i didn't get exactly what you mean?
personelCode can not be either int and string ,if so , it can not be unique and can not be realted to other tables>

1 solution

Keep it as string ..before insertion check in insertion procedure if it is already exists...otherwise it will throw sql exception...you will have flexibility in implementing if you use string since it is easy to manage than int for e.g. compare ,use in search like patterns....
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900