title: SQL Server char(1) and char(2) column
body: <p>I need a table for bookkeeping all types in the data model. I don't have that many types but a fair deal of 'em. Ideally short descripive names would work well.</p>
  
  <p>So I did this:</p>
  
  <pre><code>CREATE TABLE EntityType
  (
      EntityTypeID char(2) PRIMARY KEY,
      EntityTypeName varchar(128) NOT NULL
  )
  </code></pre>
  
  <p>And put some data into the table:</p>
  
  <pre><code>INSERT INTO EntityType VALUES ('A', 'Type1')
  INSERT INTO EntityType VALUES ('B', 'Type2')
  </code></pre>
  
  <p>But that I can query like this baffles me:</p>
  
  <pre><code>DECLARE @pEntityType char(1)
  SET @pEntityType = 'A'
  SELECT ''''+EntityTypeID+'''', EntityTypeName 
  FROM EntityType 
  WHERE EntityTypeID = @pEntityType
  </code></pre>
  
  <p>The result yields 'A ', and there's whitespace in that literal.</p>
  
  <p>My understanding is that there's an implicit conversion that's converting char(1) -> char(2)</p>
  
  <p>I'm not complaining, but what's the rationale behind this?</p>