title: How to control nullability in SELECT INTO for literal-based columns
body: <p>I am noticing that when I use this statement, the <code>Action</code> column is not nullable:</p>
  
  <pre><code>SELECT TOP 0 SerialNumber, 0 [Action] INTO #MyTable FROM FSE_SerialNumber
  </code></pre>
  
  <p>But when I use this statement, the <code>Action</code> column is nullable:</p>
  
  <pre><code>SELECT TOP 0 SerialNumber, CAST(0 as int) [Action] INTO #MyTable FROM FSE_SerialNumber
  </code></pre>
  
  <p>My reason for creating the table this way is because I don't want the temp table to inherit the collation of SerialNumber from the server default collation or elsewhere. I want it to match the collation of FSE_SerialNumber..SerialNumber.</p>
  
  <p>My question is, can I rely on the cast function giving me a nullable column, or is this not clearly defined and might change. Why does the cast suddenly make the column nullable? Is there a better way (besides comments) to clarify that my intent is to get a nullable column there?</p>