title: Should I design a table with a primary key of varchar or int?
body: <p>I know this is subjective, but I'd like to know peoples opinions and hopefully some best practices that I can apply when designing sql server table structures.</p>
  
  <p>I personally feel that keying a table on a fixed (max) length varchar is a no-no, because it means having to also propogate the same fixed length across any other tables that use this as a foreign key.  Using an <code>int</code>, would avoid having to apply the same length across the board, which is bound to lead to human error, i.e. 1 table has <code>varchar (10)</code>, and the other <code>varchar (20)</code>. </p>
  
  <p>This sounds like a nightmare to initially setup, plus means future maintaining of the tables is cumbersome too.  For example, say the keyed varchar column suddenly becomes 12 chars instead of 10.  You now have to go and update all the other tables, which could be a huge task years down the line.</p>
  
  <p>Am I wrong?  Have I missed something here?  I'd like to know what others think of this and if sticking with int for primary keys is the best way to avoid maintainace nightmares.</p>