I have a scalar function which looks up a value in a table:
FUNCTION [dbo].[fn_getLabor]
(
-- Add the parameters for the function here
@ProjectUID as nvarchar(50)
)
RETURNS decimal(25,6)
AS
BEGIN
-- Declare the return variable here
DECLARE @Labor as decimal(25,6)
-- Add the T-SQL statements to compute the return value here
set @Labor = (SELECT SUM(NUM_VALUE)
FROM MSP_TASK_CUSTOM_FIELD_VALUES
WHERE (PROJ_UID = @ProjectUID) AND MD_PROP_UID='FF8AB30F-6776-4737-A878-1739B2A1DF62')
-- Return the result of the function
RETURN @Labor
ENDI pass the ProjectUID to that function via a SSRS report using the call:
SELECT dbo.fn_getLabor(@ScheduleParam) AS Expr1) AS TotalLabor
When I allow only one schedule to be chosen in the SSRS report via the @ScheduleParam, everything works perfectly. When I allow multiple schedules to be chosen, I get an error from the function that too many arguments are specified.
Is there a way I can pass multiple parameters to the function so I can select multiple schedules in my SSRS report? Do I need to re-write the function as an in-line function instead of using the scalar function?
Thank you for any suggestions,
DJ
DJ Johnson