SAP Knowledge Base Article - Public

1256215 - NVarchar (Max) Text Field truncate at 255 characters when connecting to MS SQL Server via ODBC in Crystal Reports

Symptom

  • Text truncated at 255 characters.
  • When connecting via ODBC to MS SQL Server, long text fields are truncated.
  • Text not fully displayed, when adding a string field defined in MS SQL Server as NVarchar (Max) to a report in Crystal Reports.

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020

  • MS SQL Server 2014
  • MS SQL Server 2016
  • MS SQL Server 2019
  • MS SQL Server 2022

Reproducing the Issue

  1. In MS SQL Server database, define a database field as: VARCHAR(MAX) or NVARCHAR(MAX)
  2. Add data to the Table with text longer than 255 characters.
  3. In Crystal Reports, create a report based on MS SQL Server via ODBC
  4. The database fields defined as VARCHAR(MAX) truncate the text at 255 characters in Crystal Reports.

Cause

  • MS SQL Server ODBC driver used to connect to MS SQL Server send the database fields defined as NVarchar(Max) in MS SQL Server as a string of 255 characters to Crystal Reports. It is not a Crystal Reports issue, but a Microsoft ODBC driver issue not sending the right field definition to Crystal Reports.

Resolution

  • To display all the text for database fields defined as VARCHAR(MAX) or NVARCHAR(MAX) in MS SQL Server, when connecting via ODBC, use the supported ODBC driver to MS SQL Server corresponding to the version of MS SQL Server, and the version of Crystal Reports used. See the Supported Platforms document:

         2859510 - Supported Platforms documents for Crystal Reports      

          
  • Note: Fields defined as VARCHAR(MAX) or NVARCHAR(MAX) in MS SQL Server will show as Memo field type when using the correct Microsoft ODBC driver.

Keywords

Text truncates characters, MapMaxTypeToString, NVarchar (Max) , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Problem

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020