title: Int Variables Successfully Assigned from String Value Without Explicit Conversion
body: <p>I'm curious as to how SQL Server is able to successfully give integer variables values when they are assigned as a string. I'd expect the assignment for <code>@Int1</code> would result in a conversion failure but it works the same as the assignment for <code>@Int</code>.</p>
  
  <pre><code>DECLARE @Int INT = CAST('2' AS INT)
  SELECT @Int
  
  DECLARE @Int1 INT = '2'
  SELECT @Int1
  </code></pre>
  
  <p>Additionally, if you assign an int variable to an empty string it results in the variable given a 0 value.</p>
  
  <pre><code>DECLARE @Int3 INT = ''
  SELECT @Int3
  </code></pre>
  
  <p>I did a search looking for some sort of documentation of this behavior but all I could find was guides on how to use the cast and convert functions.</p>
  
  <p>Does anyone have a good reference or explanation as to how/ why this happens?</p>