title: SQL Server 2005 Weird varchar Behavior
body: <p>This SQL Server 2005 T-SQL code:</p>
  
  <pre><code>DECLARE @Test1 varchar;
  SET @Test1 = 'dog';
  
  DECLARE @Test2 varchar(10);
  SET @Test2 = 'cat';
  
  SELECT @Test1 AS Result1, @Test2 AS Result2;
  </code></pre>
  
  <p>produces:</p>
  
  <p><strong>Result1 = d
  Result2 = cat</strong></p>
  
  <p>I would expect either </p>
  
  <ol>
  <li>The assignment <code>SET @Test1 =
  'dog';</code> to fail because there isn't
  enough room in <code>@Test1</code></li>
  <li>Or the <code>SELECT</code> to return 'dog' in the Result1 column.</li>
  </ol>
  
  <p>What is up with <code>@Test1</code>?  Could someone please explain this behavior?</p>