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>
NOT NULL
? Are you making the column bigger (going from varchar(6) to varchar(8)) or smaller (vice versa)? Check this post stackoverflow.com/questions/11118568/… – TTeeple May 20 '15 at 13:24