Can some one tell me why I am getting the following error when I run the below query:
Error msg:
Server: Msg 8624, Level 16, State 16, Line 1
Internal SQL Server error.
Query:
SELECT
REPLACE(STR(dbo.Store.StoreNum,3),' ','0') + ' '+dbo.Store.StoreName,
REPLACE(STR(dbo.Store.DistrictCode,2),' ','0' )+' ' + dbo.Store.DistrictName,
sum(dbo.SalesDetailRetail.Quantity),
sum(dbo.SalesDetailRetail.SalePrice)
FROM
dbo.Store,
dbo.SalesDetailRetail
WHERE
( dbo.SalesDetailRetail.StoreNumber=dbo.Store.StoreNum )
AND (
( dbo.SalesDetailRetail.VoidCode = ' '
)
AND ( (dbo.SalesDetailRetail.WeekEndingDate IN(SELECT DISTINCT(dbo.weeks.isodate) FROM dbo.Weeks , dbo.MonthEndingDates JOIN dbo.YearParameters ON dbo.MonthEndingDates.MonthStartDate >= dbo.YearParameters.Start_Date and dbo.MonthEndingDates.MonthEndDate <=dbo.YearParameters.End_Date and
dbo.YearParameters.Year = (SELECT dbo.ReplicationControl.FiscalYear - 1 FROM dbo.ReplicationControl WHERE dbo.ReplicationControl.TableName = 'WEEKHST')
WHERE (dbo.weeks.Isodate >=dbo.MonthEndingDates.MonthStartDate AND dbo.weeks.Isodate <=dbo.MonthEndingDates.MonthEndDate And dbo.MonthEndingDates.MonthNum = 8) )) )
)
GROUP BY
REPLACE(STR(dbo.Store.StoreNum,3),' ','0') + ' '+dbo.Store.StoreName,
REPLACE(STR(dbo.Store.DistrictCode,2),' ','0' )+' ' + dbo.Store.DistrictName
I found something on Microsoft about this error.
FIX: Error 8624 May Occur with Subquery that Contains Aggregate or Computed Columns But according to that its been fixed in SP2 and we are on sp2.
Error msg:
Server: Msg 8624, Level 16, State 16, Line 1
Internal SQL Server error.
Query:
SELECT
REPLACE(STR(dbo.Store.StoreNum,3),' ','0') + ' '+dbo.Store.StoreName,
REPLACE(STR(dbo.Store.DistrictCode,2),' ','0' )+' ' + dbo.Store.DistrictName,
sum(dbo.SalesDetailRetail.Quantity),
sum(dbo.SalesDetailRetail.SalePrice)
FROM
dbo.Store,
dbo.SalesDetailRetail
WHERE
( dbo.SalesDetailRetail.StoreNumber=dbo.Store.StoreNum )
AND (
( dbo.SalesDetailRetail.VoidCode = ' '
)
AND ( (dbo.SalesDetailRetail.WeekEndingDate IN(SELECT DISTINCT(dbo.weeks.isodate) FROM dbo.Weeks , dbo.MonthEndingDates JOIN dbo.YearParameters ON dbo.MonthEndingDates.MonthStartDate >= dbo.YearParameters.Start_Date and dbo.MonthEndingDates.MonthEndDate <=dbo.YearParameters.End_Date and
dbo.YearParameters.Year = (SELECT dbo.ReplicationControl.FiscalYear - 1 FROM dbo.ReplicationControl WHERE dbo.ReplicationControl.TableName = 'WEEKHST')
WHERE (dbo.weeks.Isodate >=dbo.MonthEndingDates.MonthStartDate AND dbo.weeks.Isodate <=dbo.MonthEndingDates.MonthEndDate And dbo.MonthEndingDates.MonthNum = 8) )) )
)
GROUP BY
REPLACE(STR(dbo.Store.StoreNum,3),' ','0') + ' '+dbo.Store.StoreName,
REPLACE(STR(dbo.Store.DistrictCode,2),' ','0' )+' ' + dbo.Store.DistrictName
I found something on Microsoft about this error.
FIX: Error 8624 May Occur with Subquery that Contains Aggregate or Computed Columns But according to that its been fixed in SP2 and we are on sp2.