Add primary key to an existing table
ALTER TABLE tbl_trans_Attendance20 ADD CONSTRAINT PKAttendance20 PRIMARY KEY (EmployeeCode,PunchDate)
ALTER TABLE tbl_trans_Attendance20 ALTER COLUMN EmployeeCode NVARCHAR(20) NOT NULLALTER TABLE tbl_trans_Attendance20 ALTER COLUMN PunchDate [smalldatetime] NOT NULL
This is a sample for tbl_trans_Attendance20. Remember to modify this and PKAttendance20 as per the year for which the primary key need to be added
« Go back