Search code examples
crystal-reportscrystal-reports-2008database-view

Crystal Reports 2008 will not allow me to add a specific view as a datasource


I have created the following (very standard) view in my database

USE [Forms_New_V1.1]
GO

/****** Object:  View [dbo].[vwWorkDiary]    Script Date: 21/10/2019 8:21:21 AM ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


ALTER VIEW [dbo].[vwWorkDiary]
AS
SELECT        
    o.OrgCode,
    Orgname = o.Name,
    d.FirstName,
    d.LastName,
    d.CtrackTagID,
    frt.FatigueRule,
    VehicleName = v.Name,
    v.Registration,
    wd.StartTime,
    wd.EndTime,
    wd.StartCoord,
    wd.EndCoord,
    CurrentWorkMode = wmc.WorkModeName,
    SwitchWorkMode = wms.WorkModeName
FROM Organisation AS o 
JOIN Driver AS d ON o.OrganisationID = d.OrganisationID
JOIN WorkDiary AS wd ON d.DriverID = wd.DriverID 
JOIN Vehicle AS v ON wd.VehicleID = v.VehicleID
JOIN FatigueRuleType AS frt ON d.FatigueRuleTypeID = frt.FatigueRuleTypeID
JOIN WorkMode AS wmc ON wd.CurrentWorkMode = wmc.WorkModeID 
JOIN WorkMode AS wms ON wd.SwitchWorkMode = wms.WorkModeID
WHERE d.Active = 1
AND v.Active = 1
and frt.Active = 1
GO

The view works fine in the database under my credentials, and fine when I connect in as the reporting user.

When I try to add the view in Crystal I get the following error: Error adding View to Selected Tables

When I create a new connection under ODBC (RDO) I am able to add the view, however I cannot interact with it in the report, and verifying the datasource removes it.

enter image description here

The error refers to Incorrect syntax near '.1'. The only .1 in the file is the USING statement at the top, and I don't have permission to get the database renamed.

How do I add my view to my report?


Solution

  • This appeared to be a problem with the database name being invalid in the eyes of the ODBC driver. I was eventually able to get it renamed, and the problem went away.