问题是在 Management Studio 中执行的查询返回正确的结果,而在 SSRS 中则没有。例如,在 Management Studio 中的 OriginAndDestinationAddress 列返回:
"1691 W Warren Blvd, Chicago -> 697 N Frances St, South Bend"
但在数据集中返回:
"W Warren Blvd, Chicago -> 697 N Frances St, 1691 South Bend"
所以我在这两种情况下都使用相同的查询,但结果不同,我不知道是什么原因造成的。
这是查询(数据集):
SELECT CAA.Line1 + ', ' + CAA.City + ' -> ' + CAB.Line1 + ', ' + CAB.City AS OriginAndDestinationAddress, CAA.Line1 + ',' + CAA.City AS OriginAddress,
CAB.Line1 + ',' + CAB.City AS DestinationAddress, CSI.Height * CSI.Weight * CSI.Depth AS Volume, CSI.Quantity, ISNULL(CSI.ItemVolume, 0) AS ItemVolume,
ISNULL(CSI.HeavyItem, 0) AS HeavyItem, ISNULL(CSI.Damaged, 0) AS Damaged, ISNULL(CSI.DisassemblyReq, 0) AS DisassemblyReq, ISNULL(CSI.AssemblyReq,
0) AS AssemblyReq, ISNULL(CSI.PackingReq, 0) AS PackingReq, ISNULL(CSI.UnpackingReq, 0) AS UnpackingReq, ISNULL(CSI.Electrical, 0) AS Electrical,
ISNULL(CSI.Weight, 0) AS Weight, SIL.ItemName, CAA.Line1, CAA.City, CAB.Line1 AS Expr1, CAB.City AS Expr2
FROM Quote AS Q INNER JOIN
CustomerSurvey AS CS ON CS.CustomerSurveyId = Q.CustomerSurveyId INNER JOIN
CustomerSurveyItem AS CSI ON CSI.CustomerSurveyId = CS.CustomerSurveyId INNER JOIN
SurveyItem AS SI ON SI.SurveyItemId = CSI.SurveyItemId INNER JOIN
SurveyItemLabel AS SIL ON SIL.SurveyItemId = SI.SurveyItemId INNER JOIN
CustomerSurveyAddress AS CSAA ON CSAA.CustomerSurveyAddressId = CSI.OriginAddressId INNER JOIN
CustomerSurveyAddress AS CSAB ON CSAB.CustomerSurveyAddressId = CSI.DestinationAddressId INNER JOIN
CustomerAddress AS CAA ON CAA.CustomerAddressId = CSAA.CustomerAddressId INNER JOIN
CustomerAddress AS CAB ON CAB.CustomerAddressId = CSAB.CustomerAddressId inner join SurveyItemRoom as SIR on SI.SurveyItemId = SIR.SurveyItemId
WHERE (Q.QuoteId = @quoteId) AND (SIL.LangId = @CultureId)
GROUP BY CAA.Line1, CAA.City, CAB.Line1, CAB.City, CSI.Height * CSI.Weight * CSI.Depth, CSI.Quantity, CSI.ItemVolume, CSI.HeavyItem, CSI.Damaged, CSI.DisassemblyReq,
CSI.AssemblyReq, CSI.PackingReq, CSI.UnpackingReq, CSI.Weight,CSI.CustomerSurveyItemId, SIL.ItemName, CAA.Line1, CAA.City, CAB.Line1, CAB.City, CSI.Electrical