Reputation: 17
ALTER TABLE WorkOrder
ADD CONSTRAINT Wo_system PRIMARY KEY (WorkOrderNumber,AssetCode)
When i tried to execute the query above the following error is occurring :
Msg 1779, Level 16, State 0, Line 1
Table 'WorkOrder' already has a primary key defined on it.
Msg 1750, Level 16, State 0, Line 1
Could not create constraint. See previous errors.
I had deleted the primary key WorkOrderNumber
but its still creating the same error.
Can some one give me a solution for this?
Upvotes: 0
Views: 2040
Reputation: 57946
ALTER TABLE WorkOrder
DROP CONSTRAINT pk_wrkord
GO
ALTER TABLE WorkOrder
ADD CONSTRAINT Wo_system PRIMARY KEY (WorkOrderNumber,AssetCode)
GO
Upvotes: 2
Reputation: 5458
You probably did not drop the key:
Try
exec sp_pkeys 'workorder'
Upvotes: 0