ALTER TABLE WorkOrder
ADD CONSTRAINT Wo_system PRIMARY KEY (WorkOrderNumber,AssetCode)
当我尝试执行上述查询时,发生以下错误:
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.
我删除了主键WorkOrderNumber
,但仍然会产生相同的错误。
有人能为我解决这个问题吗?
答案 0 :(得分:2)
ALTER TABLE WorkOrder
DROP CONSTRAINT pk_wrkord
GO
ALTER TABLE WorkOrder
ADD CONSTRAINT Wo_system PRIMARY KEY (WorkOrderNumber,AssetCode)
GO
答案 1 :(得分:0)
你可能没有放下钥匙:
尝试
exec sp_pkeys 'workorder'