I am having an issue with Crystal, imagine that, in Visual Studio.Net.
I have created a Stored Procedure that has a "@Programs Varchar(1000)" parameter that maintains my "In" criteria. i.e. Where ProgramID In ( + @Programs" + ). @Programs is a comma seperate list of ProgramIDs. If I use Crystal 9.2.0 Standard edition I hav no problem verifying the database, however if I try to verify the database through my Visual Studio.Net version of Crystal, which is 9.2.2 it errors saying that my dynamic sql has errors (Which I know is untrue). Below if the SP syntax...Has anyone else went through this nightmare?
CREATE PROCEDURE dbo.CommPagersByProgram @ProgramID Varchar(1000) AS
Declare @SQL as Varchar(5000)
Set @SQL = 'Select Employees.FirstName + '' '' + Employees.LastName Employee,Pagers.CAPCode,Pagers.PagerNumber,Pagers.Pin,PS.PagerStatus,SR.Reason,Accounts.AccountNumber,
Sum(Invoice.Total) Total, Programs.ProgramCode,Programs.ProgramName
From Pagers
Inner Join CommunicationDetails CD On CD.CommunicationID = Pagers.CommunicationID
Left Join Accounts On Accounts.AccountID = CD.AccountID
Left Join DetailPrograms DP On DP.DetailID = CD.DetailID
Left Join Employees On Employees.EmployeeID = CD.EmployeeID
Left Join Invoice On Invoice.DetailID = CD.DetailID
Left Join Programs On Programs.ProgramID = DP.ProgramID
Left Join PagerStatuses PS On PS.PagerStatusID = Pagers.PagerStatusID
Left Join StatusReasons SR On SR.ReasonID = Pagers.ReasonID
Where CD.EndDate Is Null And DP.ProgramID In (' + @ProgramID + ')
Group By CD.DetailID,Employees.FirstName + '' '' + Employees.LastName,Pagers.CAPCode,Pagers.PagerNumber,Pagers.Pin,PS.PagerStatus,SR.Reason,Accounts.AccountNumber
,Programs.ProgramCode,Programs.ProgramName
Order By Employee'
Exec (@SQL)
GO
I have created a Stored Procedure that has a "@Programs Varchar(1000)" parameter that maintains my "In" criteria. i.e. Where ProgramID In ( + @Programs" + ). @Programs is a comma seperate list of ProgramIDs. If I use Crystal 9.2.0 Standard edition I hav no problem verifying the database, however if I try to verify the database through my Visual Studio.Net version of Crystal, which is 9.2.2 it errors saying that my dynamic sql has errors (Which I know is untrue). Below if the SP syntax...Has anyone else went through this nightmare?
CREATE PROCEDURE dbo.CommPagersByProgram @ProgramID Varchar(1000) AS
Declare @SQL as Varchar(5000)
Set @SQL = 'Select Employees.FirstName + '' '' + Employees.LastName Employee,Pagers.CAPCode,Pagers.PagerNumber,Pagers.Pin,PS.PagerStatus,SR.Reason,Accounts.AccountNumber,
Sum(Invoice.Total) Total, Programs.ProgramCode,Programs.ProgramName
From Pagers
Inner Join CommunicationDetails CD On CD.CommunicationID = Pagers.CommunicationID
Left Join Accounts On Accounts.AccountID = CD.AccountID
Left Join DetailPrograms DP On DP.DetailID = CD.DetailID
Left Join Employees On Employees.EmployeeID = CD.EmployeeID
Left Join Invoice On Invoice.DetailID = CD.DetailID
Left Join Programs On Programs.ProgramID = DP.ProgramID
Left Join PagerStatuses PS On PS.PagerStatusID = Pagers.PagerStatusID
Left Join StatusReasons SR On SR.ReasonID = Pagers.ReasonID
Where CD.EndDate Is Null And DP.ProgramID In (' + @ProgramID + ')
Group By CD.DetailID,Employees.FirstName + '' '' + Employees.LastName,Pagers.CAPCode,Pagers.PagerNumber,Pagers.Pin,PS.PagerStatus,SR.Reason,Accounts.AccountNumber
,Programs.ProgramCode,Programs.ProgramName
Order By Employee'
Exec (@SQL)
GO