SAP Knowledge Base Article - Public

1875926 - Error: '42S02:[Microsoft][SQL Server Native Client 11.0][SQL Server] Invalid object name <Table Name> [Database Vendor Code: 208]', when refreshing a report in Crystal Reports

Symptom

  • Error when refreshing a report.
  • After updating a report, it fails with an error: "Invalid Object Name"
  • After setting the data source location of a report from one SQL Server database to another SQL Server database that resides on the same server, it fails.
  • When refreshing a report in Crystal Reports based on an ODBC connection to MS SQL Server, it fails with the error:
      
       "Failed to retieve data from the database.
         Details: 42S02:[Microsoft][SQL Server Native Client 11.0][SQL Server]
         Invalid object name <Table Name>
         [Database Vendor Code: 208]"

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020
        
  • MS SQL Server 2014
  • MS SQL Server 2016
  • MS SQL Server 2017
  • MS SQL Server 2019

Reproducing the Issue

  1. In Crystal Reports, open an existing report based on an ODBC connection to MS SQL Server.
  2. Refresh the report.
        
    It fails with the error: "Failed to retieve data from the database... Invalid object name <Table Name>..."

Cause

  • One of the Table or View used on the original report:
    • Does not exist in the database selected; or
    • The database user does not have rights to it.

Resolution

  • Contact the MS SQL Server Database Administrator to:
    • Confirm the Table, or View exist; and
    • The database user, used to connect to MS SQL Server, has rights to view it. 

           
  • If the Table or View Exist:
      
    If the Table or View exist, and you have a database user which have rights to see the Table or View, and are still receiving the error, then the error occur because the report is not pointing to the right MS SQL Server database. To point to the right database where the Table or View exist, perform a Set Data Source location:
          
    1. In Crystal Reports, open the report.
    2. Under the menu "Database", select "Set Datasource Location..."
    3. In "Set Datasource Location", under "Current Data Source", select the Table or View name that appears in the error message.
    4. In the section "Replace with", under "ODBC", expand the same data source connection to MS SQL Server, and select the Table or View under the correct MS SQL Server database.
    5. Click on the button "Update"
    6. Click "Close"
    7. Save the report.
       
        
  • If the Table or View No Longer Exist:

    If the Table or View no longer exist, then perform a "Verify Database" to update the report definition to remove the object from the report.
      
    1. In Crystal Reports, open the report.
    2. Under the menu "Database", select "Verify Database"
    3. You will receive a message to fix the report, which will remove the Table or View from the report.
    4. If there was formulas using those Tables, the formulas will need to be updated manually.
    5. Save the report.

Keywords

SAP Crystal Reports, CR, Data Source, Set Datasource Location, Database Connector Error: 42S02 , 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