i have a scalar valued function like this
CREATE FUNCTION getTotalWorkingSeconds(@machineList varchar(255))
RETURNS int
AS
BEGIN
declare @res int
Select @res = Sum(DURATION) From PROCESSDATA where MACHINEID in (@machineList)
return @res
END
i tried to use it like these
SELECT dbo.getTotalWorkingSeconds('3,2')
result; Conversion failed when converting the varchar value '3,2' to data type int.
--
SELECT dbo.getTotalWorkingSeconds(''''+'3,2'+'''')
result; Conversion failed when converting the varchar value ''3,2'' to data type int.
how i can pass id list to this function?
Edit: i can alter the function.