From a web page (UD4), I am trying to run a SP. I want to pass 3 variable to the SP. A beginning date, ending date and string to be used in an IN() statement. I can hard code the SP as below and it returns a value. But When I declare @DeptHdr and change the code to Dept IN (@DeptVar) and then try to pass the string 42500, 43500, it does not return any values.
Is it possible to pass a variable this way into an IN statement?
AS Select Dept, Sum((Grade7 + Grade8 + Grade9 + Grade10 + Grade3)* OutOfService) As TotHrs, Sum(TotalCost) AS TotCost
Where (Dept IN (42500, 43500)) AND CompletionDate Between @BegDate AND @EndDate
Group By Dept