update tbl_CRM_fiscalCalendar
set weeksElapsed =
where fiscalYear =
and ownerId =
and ownerType = 'MFR'
select top 1 convert( int, forecast_year ) fy, convert( int, forecast_month ) m
from tbl_MFR_TPF_Detail#_tpfSuffix# with (nolock) where mfr_Id =
and tpartnerType = 'CDR' and forecast_status = 'A'
and ( coalesce( forecast_qty, 0 ) <> 0 or coalesce( forecast_amt, 0 ) <> 0 or coalesce( forecast_alt, 0 ) <> 0 )
and convert( int, forecast_year ) <=
order by fy desc, m desc
select fiscalYear, weeksInYear, weeksElapsed, 0 newWeeksElapsed
from tbl_CRM_FiscalCalendar
where ownerId =
and ownerType = 'MFR'
order by fiscalYear