title: Use a condition inside a SQL Server 2016 WITH and OPENJSON to change the update value
body: <p>I currently have in a SQL Server 2016 stored procedure</p>
  <pre><code>@pmidInfo NVARCHAR(MAX) ='{&quot;pmid&quot;:&quot;31390573&quot;,&quot;journal&quot;:&quot;Cell Rep&quot;,&quot;issn&quot;:&quot;&quot;,&quot;essn&quot;:&quot;2211-1247&quot;,&quot;sortpubdate&quot;:&quot;2019/08/06 00:00&quot;,&quot;pubYear&quot;:&quot;2019&quot;}'
  
  SELECT * 
  INTO #TempTable
  FROM OPENJSON (@pmidInfo)  
       WITH (   
                pmid     varchar(15)   '$.pmid',  
                journal  nvarchar(500) '$.journal',  
                issn     varchar(10)   '$.issn',  
                essn     varchar(10)   '$.essn',  
                sortpubdate  varchar(15)  '$.sortpubdate',
                pubYear  varchar(10)   '$.pubYear'  
            )
  
  UPDATE #TempTable
  SET issn = REPLACE(essn, '-', '')
  WHERE issn = ''
  </code></pre>
  <p>Is there a way that I can do the <code>UPDATE</code> inside the <code>OPENJSON</code> so that it is done more efficiently? I'm new to using <code>WITH</code> and <code>OPENJSON</code>.</p>
  <p>Thanks</p>