I have table with following details
Table name EMPLOYEE
and columns
EMPID (PK smallint not null)
EMPNAME (varchar 256 not null)
ORG (FK smallint not null)
FUNCTION (FK smallint not null)
EFF_DATE (datetime null)
AUDIT_ID (varchar null)
Now I have to add an extra coulmn to this table ADD_UID
and make it also primary key
I am using this query but failing.
ALTER TABLE CVADMIN.EMPLOYEE
ADD ADD_UID varchar(32) NULL,
CONSTRAINT PK_EMPLOYEE PRIMARY KEY [NON]CLUSTERED (ADD_UID)
go
Table 'EMPLOYEE
' already has a primary key defined on it.
EDIT
The idea here is the new column should be unique so that if it fails I can throw _KEY_VIOLATION so that some code manipulation is done