CREATE PROCEDURE spReportpositive 
    @ModalityType varchar(18), 
    @StatStartDttm datetime,
    @StatEndDttm datetime 
AS
BEGIN
 
DECLARE @iStudy_key int
DECLARE @sReportpositive int


DECLARE crStudy CURSOR FOR

SELECT Study_key, report_positive
FROM study
WHERE study_modalitytype=@ModalityType  AND report_state > 0 AND
	study_dttm >= @StatStartDttm AND study_dttm <= @StatEndDttm 

OPEN crStudy

FETCH NEXT FROM crStudy 
INTO @iStudy_key,@sReportpositive
 

CLOSE crStudy     
DEALLOCATE crStudy 

END