我创建了一个存储过程(在 SSRS 中使用),它的参数值大于一个。当我通过提供该参数的值在 SSMS 中执行此存储过程时,SP 不返回任何结果。它应该返回超过 1 行
下面是给出的SP
CREATE PROCEDURE [dbo].[sp_tst_CSENG_JulieCapitalHours]
@StartDate DATETIME ,
@EndDate DATETIME ,
@ProjHomeGrp NVARCHAR(MAX) ,
@ProjHier NVARCHAR(MAX)
AS
BEGIN
SELECT [Capital Project] ,
[Capital Task] ,
ResourceName ,
ProjectName ,
[Project Home Group] ,
ActualWork ,
TimeByDay ,
ResourceStandardRate ,
ActualWork * ResourceStandardRate AS Dollars ,
[Project Hierarchy]
FROM [IR.CapOnly]
WHERE ( TimeByDay >= @StartDate )
AND ( [Project Home Group] IN ( @ProjHomeGrp ) )
AND ( TimeByDay <= @EndDate )
AND ( ActualWork > 0 )
AND ( [Project Hierarchy] IN ( @ProjHier ) )
ORDER BY ProjectName ,
ResourceName
END
您可以看到在 where 子句中,Project Home Group ( @ProjHomeGrp
) 和 Project Hierarchy ( @ProjHier
) 是参数,其值在提供时(大于 1)SP 返回零值。
我传递的价值是:
Start Date: 1/1/2011
End Date: 12/31/2012
@ProjHomeGrp : PHG1,PHG2,PHG3,PHG4,PHG5,PHG6,PHG7
@ProjHier: PROH1, PROH2, PROH3
让我知道任何问题!