title: What are the details for using CF_SQL_NVARCHAR in ColdFusion 10?
body: <p>The ColdFusion 10 documentation on Updating Your Database has a section on <a href="http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea77859461172e0811cbec0e02b-7ff3.html#WSe61e35da8d318518-9efe7cf1358680a71d-8000" rel="nofollow noreferrer">Database-related enhancements in ColdFusion 10</a>.  That page mentions that there is now support for <code>CF_SQL_NVARCHAR</code> among others, but with no details about them.  Additionally, the <a href="http://help.adobe.com/en_US/ColdFusion/10.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f6f.html" rel="nofollow noreferrer">cfqueryparam documentation</a> hasn't been updated to include their existence.</p>
  
  <p>The <a href="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f6f.html" rel="nofollow noreferrer">ColdFusion 9 documentation for cfqueryparam</a> mentions that <code>CF_SQL_VARCHAR</code> maps to <code>varchar</code> in MSSQL.  This is true unless the ColdFusion Administrator <a href="http://help.adobe.com/en_US/ColdFusion/9.0/Admin/WSc3ff6d0ea77859461172e0811cbf364104-7fe5.html" rel="nofollow noreferrer">datasource settings</a> has the <code>String Format</code> setting enabled.  In which case <code>CF_SQL_VARCHAR</code> maps to <code>nvarchar</code>.  This poorly documented feature is a hack which can <a href="https://stackoverflow.com/questions/10543755/slow-query-with-cfqueryparam-searching-on-indexed-column-containing-hashes">cause performance issues</a> within ColdFusion.</p>
  
  <p>So it's great that they have introduced <code>CF_SQL_NVARCHAR</code>, but it would be good to understand how it works.  It is simply an alias for <code>CF_SQL_VARCHAR</code> making it pointless?  Does it always send strings as <code>nvarchar</code>?  If so, does <code>CF_SQL_VARCHAR</code> always send in <code>varchar</code>?</p>
  
  <p>I would hope that for backward compatibility's sake it is implemented as such:</p>
  
  <p>If <code>String Format</code> is enabled <code>CF_SQL_VARCHAR</code> and <code>CF_SQL_NVARCHAR</code> both map to <code>nvarchar</code>.</p>
  
  <p>If <code>String Format</code> is disabled then <code>CF_SQL_VARCHAR</code> maps to <code>varchar</code> and <code>CF_SQL_NVARCHAR</code> maps to <code>nvarchar</code>.</p>
  
  <p>This would mean any pre-CF10 sites can move to CF10 and work, with the same performance considerations pre-CF10.</p>
  
  <p>New sites, or sites that rewrite all queries to match <code>CF_SQL_VARCHAR</code> and <code>CF_SQL_NVARCHAR</code> with the database design will not get the performance penalty that is unavoidable pre-CF10.</p>
  
  <p>Can anyone confirm if this is the case; even better if with something official?</p>