I have this stored procedure:
ALTER PROCEDURE [dbo].[GetContactsByAdmission]
@pvi_unit varchar(300)
AS
SET NOCOUNT ON
SELECT PA.pad_reference, PA.pad_admission_date, PA.pad_admission_type, PV.pvi_unit, P.pat_mrn
FROM patient_admissions AS PA LEFT OUTER JOIN
patient_visits AS PV ON PA.pad_phi_ref_no = PV.pvi_pad_phi_ref_no INNER JOIN
patient_history AS PH ON PA.pad_phi_ref_no = PH.phi_ref_no INNER JOIN
patients AS P ON PH.phi_pat_ref_no = P.pat_ref_no
WHERE (PV.pvi_unit IN (@pvi_unit)) AND (PV.pvi_date BETWEEN '1/24/2014 10:37:00' AND '1/24/2014 10:51:00')
But no rows are returned. The problem is with my "IN" clause. If I hardcode the values instead of using my parameter, then it works. So the problem is my parameter which ...
Go to the complete details ...