title: Insert blank VBA variable into SQL decimal(x,y) field as Null
body: <p>I have a ADODB command in Excel 2013 VBA to execute a Insert string in a table where some fields are Decimal(x,y) in my SQL Server 2014. I'm having problems when my excel cell is empty to insert it as NULL into SQL.</p>
  
  <p>ie.</p>
  
  <p>VBA Code:</p>
  
  <p>Lets say variable <strong>sPrice</strong> can point to an empty excel cell.</p>
  
  <pre><code>sDate = .Cells(iRowNo, 1)
  sPrice = .Cells(iRowNo, 2)
  sQuantity = .Cells(iRowNo, 3)
  </code></pre>
  
  <p>And the argument of my Insert lets say:</p>
  
  <pre><code>conn.Execute "INSERT INTO [dbo].[Prices] ([date], [Price], [Quantity])
                values ('" &amp; SDate &amp; "', " &amp; sPrice &amp; ",'" &amp; sQuantity &amp; "')"
  </code></pre>
  
  <p>note in SQL data types are:</p>
  
  <pre><code>[date] Datetime
  [Price] Deciaml(28,12)
  [Quantity] Real
  </code></pre>
  
  <p>So I not including double single quote for sPrice as it's a Decimal.
  thanks,</p>