title: "String data, right truncation" warning on a select statement
body: <p>I am upscaling an access 2003 database to SQL Server Express 2008.  The tables appear to be created ok and the data looks ok.</p>
  
  <p>I have an MFC application that connects to this database.  It worked fine connecting to access, but when I connect to SQL Server I am getting the following error on a select statement.</p>
  
  <pre><code>DBMS: Microsoft SQL Server
  Version: 10.50.1600
  ODBC Driver Manager Version: 03.80.0000
  Warning: ODBC Success With Info on field 0.
  String data, right truncation
  
  State:01004,Native:0,Origin:[Microsoft][ODBC SQL Server Driver]
  </code></pre>
  
  <p>The data that is returned should be 8 characters but is only 7 with the right most character truncated.  </p>
  
  <p>The access front end can read the data from SQL Server correctly.</p>
  
  <p>The field in the SQL Server table is defined as nvarchar with a length of 8.</p>
  
  <p>The code to read the field looks something like</p>
  
  <pre><code>CDatabase Database;
  CString sSerialNumber = "00000000";
  CString SqlString;
  
  CString sDsn = "Driver={SQL Server};Server=server\\db;Database=Boards;Uid=uid;Pwd=pwd;Trusted_Connection=False";
  Database.Open(NULL,false,false,sDsn);
  
  CRecordset recset( &amp;Database );
  SqlString.Format("Select SerialNumber from boards where MACAddress = '%s'",mac);
  recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);
  recset.GetFieldValue("SerialNumber",sSerialNumber);
  </code></pre>
  
  <p>After this, sSerialNumber should be 12345678 but its 1234567</p>
  
  <p>Thanks for the help</p>