(Background info: Running XP locally, MS 2003 server for the DB operating system, XI Crystal developer edition with MS SQL 2005 database using Microsoft SQL Server ODBC Driver Version 03.85.1117 – Driver.)
I have a stored procedure that looks like this:
I created a command in Crystal XI that states the following:
My problem is that while Crystal can send the input variables its freaking out about the output variables.
Currently my error message is:
Database Connector Error: 'HY010:[Microsoft][ODBC Driver Manager] Function sequence Error'
I've tried different combinations of using my output variables like removing them, or having only the Crystal Parameter there, or only the SQL Server Paramater name, but those combinations don't work either. Examples are below:
Nor did this work:
Any idea how I get past this?
Thanks,
Keith
I have a stored procedure that looks like this:
Code:
CREATE PROCEDURE dbo.spSumRates
-- Add the parameters for the stored procedure here
@GroupNumber varchar(255),
@ScaleName varchar(255),
@SiteId int,
@SitesName nvarchar(255),
@ReportMonth int,
@ReportYear int,
@Rate decimal (10,2) Output,
@AdjRate decimal (10,2) Output,
@Received decimal (10,2) Output
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT /*CompanyName.Name, GroupInfo.[GroupNumber], CommissionScales.[Name], Sites.Name, */
@Rate= SUM(CAST(ReportAdjBreaks.Rate AS decimal(10, 2))),
@AdjRate = SUM(
(case WHEN ReportAdjustments.IsCredit = 1 THEN -1 else 1 END)
* ReportAdjMonths.Months
* CAST(ReportAdjBreaks.Rate AS decimal(10, 2)
)
),
@Received = SUM(
CAST (Reports.AmountReceived AS decimal(10, 2))
)
FROM [wolftracs].[dbo].[Reports]
-- All rows from Reports even those which do not have records in Sites.
LEFT OUTER JOIN [wolftracs].[dbo].[Sites] ON Reports.[SiteID] = Sites.[ID]
-- All rows from Sites, even those which do not have records in SiteGroups.
LEFT OUTER JOIN [wolftracs].[dbo].[SiteGroups] ON Sites.[SiteGroupID] = SiteGroups.[ID]
-- All rows from SiteGroups, even those which do not have records in Companies.
LEFT OUTER JOIN [wolftracs].[dbo].[Companies] ON SiteGroups.[CompanyID] = Companies.[ID]
-- All rows from Companies, even those which do not have records in GroupInfo.
LEFT OUTER JOIN [wolftracs].[dbo].[GroupInfo] ON Companies.[ID] = GroupInfo.[TargetID]
-- Only rows that are in both tables
INNER JOIN [wolftracs].[dbo].[ReportAdjustments] ON Reports.[ID] = ReportAdjustments.[ReportID]
INNER JOIN[wolftracs].[dbo].[ReportAdjMonths] ON ReportAdjustments.[ID] = ReportAdjMonths.[rAdjustmentID]
INNER JOIN [wolftracs].[dbo].[ReportAdjBreaks] ON ReportAdjMonths.[ID] = ReportAdjBreaks.[rAdjMonthID]
-- All rows from ReportAdjustments, even those which do not have records in ReportPlans.
LEFT OUTER JOIN [wolftracs].[dbo].[ReportPlans] ON ReportAdjustments.[rPlanID] = ReportPlans.[ID]
-- All rows from ReportPlans, even those which do not have records in PlansAvailable.
LEFT OUTER JOIN [wolftracs].[dbo].[PlansAvailable] ON ReportPlans.[AvailID] = PlansAvailable.[ID]
-- All rows from PlansAvailable, even those which do not have records in CommissionScales.
LEFT OUTER JOIN [wolftracs].[dbo].[CommissionScales] ON PlansAvailable.[CommissionScaleID] = CommissionScales.[ID]
WHERE GroupInfo.GroupNumber = @GroupNumber and
CommissionScales.[Name] = @ScaleName and
substring(Sites.[Name], 6, len(Sites.[Name]) - 5) = @SitesName and
Reports.ReportMonth = @ReportMonth and
Reports.ReportYear = @ReportYear and
Reports.SiteID = @SiteId
GROUP BY Companies.[Name],
GroupInfo.GroupNumber,
CommissionScales.[Name],
substring(Sites.[Name], 6, len(Sites.[Name]) - 5),
Reports.ReportMonth,
Reports.ReportYear
I created a command in Crystal XI that states the following:
Code:
EXEC spSumRates @GroupNumber={?GroupNumber},@ScaleName={?ScaleName}, @SiteID={?SiteID}, @SitesName={?SitesName}, @ReportMonth={?ReportMonth}, @ReportYear={?ReportYear}, @Rate={?Rate}, @AdjRate={?AdjRate}, @Received={?Received}
My problem is that while Crystal can send the input variables its freaking out about the output variables.
Currently my error message is:
Database Connector Error: 'HY010:[Microsoft][ODBC Driver Manager] Function sequence Error'
I've tried different combinations of using my output variables like removing them, or having only the Crystal Parameter there, or only the SQL Server Paramater name, but those combinations don't work either. Examples are below:
Code:
EXEC spSumRates @GroupNumber={?GroupNumber},@ScaleName={?ScaleName}, @SiteID={?SiteID}, @SitesName={?SitesName}, @ReportMonth={?ReportMonth}, @ReportYear,@Rate,@AdjRate,@Received
Nor did this work:
Code:
EXEC spSumRates @GroupNumber={?GroupNumber},@ScaleName={?ScaleName}, @SiteID={?SiteID}, @SitesName={?SitesName}, @ReportMonth={?ReportMonth}, {ReportYear},{Rate},{AdjRate},{Received}
Any idea how I get past this?
Thanks,
Keith