title: How to change the column length of a primary key in SQL Server?
body: <p>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: </p>
  
  <blockquote>
    <p>Msg 5074, Level 16, State 1, Line 1<br>
    The object 'PK_TableName' is dependent on column 'PersonID'.</p>
  </blockquote>
  
  <p>PersonID = PK. </p>
  
  <p>I've read <a href="https://stackoverflow.com/questions/4372176/what-is-the-sql-to-change-the-field-length-of-a-table-column-in-sql-server">What is the sql to change the field length of a table column in sql server</a> which only applies to non-PK columns. </p>
  
  <p>I tried this: </p>
  
  <pre><code>ALTER TABLE table_name
  ALTER COLUMN column_name &lt;new datatype&gt;
  </code></pre>