How to alter length of varchar in composite primary key?
问题 In MSSQL I have a table created like this: CREATE TABLE [mytable] (fkid int NOT NULL, data varchar(255) CONSTRAINT DF_mytable_data DEFAULT '' NOT NULL); ALTER TABLE [mytable] ADD CONSTRAINT PK_mytable_data PRIMARY KEY (fkid, data); Now I want to increase the length of the 'data' column from 255 to 4000. If I just try: ALTER TABLE [mytable] ALTER COLUMN data varchar(4000); Then I get this error: The object 'PK_mytable_data' is dependent on the column 'data' If I try this: ALTER TABLE [mytable]