title: How do you Insert a newid() into column while using FROM opensjon
body: <p>I want to insert a <code>newid()</code> into a table.  It's not supplied in the JSON object itself, so I need to pass it in somehow.  I can't seem to do that...</p>
  
  <pre><code>declare @jsonString nvarchar(max),
  
  --sample incoming data, JSON object
  set @jsonString = '{
  
      "PosTitle": "Tech",
      "PosCode": "699887",
      "FileName": "clickme.exe",
  
  }'
  </code></pre>
  
  <p>I can parse the JSON string successfully, and insert it into the temp table:</p>
  
  <pre><code>    --establish temp table
  CREATE TABLE #tblDestination(
      [id] [uniqueidentifier] default newsequentialid(),
      [PosTitle] [varchar](80) NULL,
      [PosCode] [varchar](5) NULL,
      [FileName] [varchar](60) NULL,
  
  )
  
  --parse the JSON string
  --and insert it into the temp table
  insert into #tblDestination
  select *
  from openjson(@jsonString, '$')
  with 
  (
  
      newid(), --I need to insert a newid() into the [id column]
      PosTitle varchar(80) '$.PosTitle',
      PosCode varchar(5) '$.PosCode',
      [FileName] varchar(60) '$.FileName',
  
  
  )
  </code></pre>
  
  <p>I kinda can get it to work...  Columns in the source must be lined up perfectly with the destination.  The source doesn't have a <code>newid()</code>, so I need to build one and pass it in... but I can't figure out how to do that.</p>
  
  <p>My understanding is that <code>with</code> is part of a CTE.</p>
  
  <p>I was trying to avoid having to declare a var for each of the keys/values, and manually plucking each one out via <code>select JSON_VALUE</code>.</p>