title: SQL Server: pass datatable to stored procedure with a null value
body: <p>I have created a user-defined table type in SQL Server and passed as parameter to a stored procedure.</p>
  
  <p>From C#, I create a <code>DataTable</code>, then I populate it with the same number of columns as that in the table type in SQL Server, also column types are the same. </p>
  
  <p>This table type I have created in SQL Server allows for null values for some columns, so from C# when I do not need to set them I set as null type.</p>
  
  <p>Then from my stored procedure I do:</p>
  
  <pre><code>CREATE PROCEDURE [MySP] 
      @Data MyDataType READONLY
  AS
  BEGIN
      SET NOCOUNT ON;
  
      INSERT INTO OneTable
          SELECT *  
          FROM @Data
  END
  </code></pre>
  
  <p>My question is: what does SQL Server do when it finds a column in the user-defined table as null? Will it recognize C# null type and automatically insert into the target column table <code>OneTable</code> as a correct SQL Server <code>NULL</code> value? </p>