I’m trying to drop a primary key constraint from a table using the following
ALTER TABLE SchemaName.LabourGrade DROP CONSTRAINT Labour_Grade_pk
and getting the error Labour_Grade_pk is not a constraint.
when I do
SELECT * FROM sysobjects WHERE name = 'LabourGrade_pk'
I get one row back. It does have FKs to it so I tried dropping those first but same problem.
I only want to drop the PK so as to change the column’s datatype, is there better way to do this?
Yes, you don’t need to drop and recreate the PK (and associated index(es)) for this at all. You can do it as a simple metadata change via
ALTER TABLE ... ALTER COLUMN.