How to change the column length of a primary key in SQL Server?
问题 I know how to change the length of a column, but my SQL statement fails because the column I'm trying to change is a PK, so I get the following error: Msg 5074, Level 16, State 1, Line 1 The object 'PK_TableName' is dependent on column 'PersonID'. PersonID = PK. I've read What is the sql to change the field length of a table column in sql server which only applies to non-PK columns. I tried this: ALTER TABLE table_name ALTER COLUMN column_name <new datatype> 回答1: See below sample example how