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 |
|
LearningIT
Starting Member
5 Posts |
Posted - 2010-06-09 : 04:38:28
|
| i am using MS SQL Server 2005 with Management Studio. I have an employee table contains following fieldsEmployeeId [PK, IDENTITY Column]EmployeeCodeEmployeeNameDOBCNICGenderMaritalStatusI need to create EmployeeCode also a unique field so that no duplication employee codes can be entered in the table. because this is the rule that each employee will have only one Employee Code.Can anyone help me ? I'd be thankful. |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2010-06-09 : 04:42:31
|
| ALTER TABLE employee ADD CONSTRAINT unq_k UNIQUE (EmployeeCode) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-09 : 04:42:54
|
| Create a unique constraint on EmployeeCodeMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-06-09 : 04:43:28
|
MadhivananFailing to plan is Planning to fail |
 |
|
|
LearningIT
Starting Member
5 Posts |
Posted - 2010-06-09 : 08:31:29
|
| Thankyou all, problem has been fixed with you valuable help. :-) |
 |
|
|
|
|
|