How to set default value while insert null value into not null column SQL Server?
<p>I have two tables <code>t1</code> and <code>t2</code>. Both have <code>id</code> and <code>name</code> columns. The name column of <code>t1</code> is defined as not null and it has the default value of 'Peter'.</p>

<p>I want to insert all the values from <code>t2</code> into my <code>t1</code> table. But I have some null values in <code>t2</code> table. When I try to insert the values:</p>

<pre><code>Insert into t1 
   select * 
   from t2;
</code></pre>

<p>It throws this error:</p>

<blockquote>
  <p>Msg 515, Level 16, State 2, Line 1<br>
  Cannot insert the value NULL into column 'Name',  table 'T1'; column does not allow nulls. </p>
</blockquote>

<p>Is there any possibilities to set the default value to the column when we try to <code>insert</code> the <code>null</code> value.</p>