Create A Cursor with loop conditon I am try to make a cursor with loop condition.
purpose of cursor:- I want to execute a procedure 17times .

Procedure definition:  

dbo.ALLAARTI_MIS_SUMMARY @IN_SYSDIFF = @IN_DIFF

DECLARE @IN_DIFF int
DECLARE vendor_cursor CURSOR FOR
SELECT date_time FROM dumy_mis  
OPEN vendor_cursor

FETCH NEXT FROM vendor_cursor   
INTO @IN_DIFF

WHILE @@FETCH_STATUS = 0
BEGIN
exec dbo.ALLAARTI_MIS_SUMMARY @IN_SYSDIFF = @IN_DIFF
END
CLOSE vendor_cursor  
DEALLOCATE vendor_cursor
I'm not sure what are you trying to achieve with this script, but you should fetch next records inside WHILE block just to be sure that @@FETCH_STATUS=0

dbo.ALLAARTI_MIS_SUMMARY @IN_SYSDIFF = @IN_DIFF

DECLARE @IN_DIFF int
DECLARE vendor_cursor CURSOR FOR
SELECT date_time FROM dumy_mis  
OPEN vendor_cursor

FETCH NEXT FROM vendor_cursor   
INTO @IN_DIFF

WHILE @@FETCH_STATUS = 0
BEGIN
    exec dbo.ALLAARTI_MIS_SUMMARY @IN_SYSDIFF = @IN_DIFF

    FETCH NEXT FROM vendor_cursor   
    INTO @IN_DIFF
END
CLOSE vendor_cursor  
DEALLOCATE vendor_cursor