title: SQL Server : error converting data type nvarchar to decimal
body: <p>The following piece of code is opening a JSON message and is inserting the value that corresponds to the '$.disgust' field on the JSON message on the <code>post_metric_score</code> table. It works fine in general except when the value is something like that:</p>
  <pre><code>&quot;disgust&quot;: 5.6780936574796215e-05. 
  </code></pre>
  <p>The error that I get is</p>
  <blockquote>
  <p>Error converting data type nvarchar to decimal</p>
  </blockquote>
  <pre><code>INSERT INTO [Database].[post_metric_score] ([post_id], [metric_id], [score])
      SELECT @post_id, 4, [score]
      FROM OPENJSON(@postJson, '$.sentiment_results.emotions')
           WITH ([score] DECIMAL(12, 8) '$.disgust') 
  </code></pre>
  <p>I tried to add a convert statement in the SELECT statement but it doesn't work e.g.</p>
  <pre><code>SELECT @post_id, 6, CONVERT(DECIMAL(12,8), [score]) AS [score] 
  </code></pre>
  <p>Any ideas of what I am doing wrong?</p>