datetimedeclare @TimeInR datetimeset @FromDate= '2009-01-14'
Declare cc cursor for select distinct empid from ta_timecardwhere schedindate between @FromDate and @
from ta_timecard where schedindate between @FromDate and @ToDatefetch next from cc into @empidand @ToDatefetch next from cc2 into @departmentID
while (@@fetch_status = 0)from ta_timecard where schedindate between @