obsolete ---> select ownerId, ownerType from tbl_SPL_Opportunities with (nolock) inner join tblBrokers b with (nolock) on b.broker_Id = ownerId where subjectType = 'PRD' and ownerId = #attributes.clientid# and ownerId > 0 and ownerType = 'BRO' union select ownerId, ownerType from tbl_SPL_Opportunities with (nolock) inner join tblManufacturers m with (nolock) on m.mfr_id = ownerId where subjectType = 'PRD' and ownerId = #attributes.clientid# and ownerId > 0 and ownerType = 'MFR' union select ownerId, ownerType from tbl_CRM_Interactions with (nolock) inner join tblBrokers b with (nolock) on b.broker_id = ownerId where ownerType = 'BRO' and ownerId = #attributes.clientid# and ownerId > 0 ---> select top 1 * from tbl_DW_ScorecardFacts where timeframeId = 0 obsolete ---> select MFR_Name as name from tblManufacturers where MFR_ID = select BROKER_NAME as name from tblBrokers where BROKER_ID = obsolete ---> select timeframeId, ownerId, ownerType, startDate, endDate, weeks, weeksRemaining, weeksElapsed, periodCode from tbl_DW_Timeframes with (nolock) where ownerId = and ownerType = and fiscalYear = and periodCode = and periodNumber = set nocount on insert into tbl_DW_Timeframes ( ownerId, ownerType, startDate, endDate, fiscalYear, periodCode, periodNumber, name, weeks, weeksElapsed, weeksRemaining, calendarMonth, calendarYear ) values( , , , , , , , , , , , , ) select timeframeId = @@identity set nocount off select timeframeId, ownerId, ownerType, startDate, endDate, weeks, weeksRemaining, weeksElapsed, periodCode from tbl_DW_Timeframes with (nolock) where timeframeId = select timeframeId, ownerId, ownerType, startDate, endDate, weeks, weeksRemaining, weeksElapsed, periodCode from tbl_DW_Timeframes with (nolock) where ownerId = and ownerType = and fiscalYear = and periodCode = and periodNumber = set nocount on insert into tbl_DW_Timeframes ( ownerId, ownerType, startDate, endDate, fiscalYear, periodCode, periodNumber, name, weeks, weeksElapsed, weeksRemaining, calendarMonth, calendarYear ) values( , , , , , , , , , , , , ) select timeframeId = @@identity set nocount off select timeframeId, ownerId, ownerType, startDate, endDate, weeks, weeksRemaining, weeksElapsed, periodCode from tbl_DW_Timeframes with (nolock) where timeframeId = delete from tbl_DW_Timeframes where ownerId = and ownerType = and fiscalYear = and periodCode = 'FM' and periodNumber = select distinct m.fspro_userid subjectId, 'USR' subjectType from tbl_TER_Territories t with (nolock) inner join tbl_TER_TeamMembers tm with (nolock) on tm.territoryId = t.territoryId inner join tbl_FSpro_members m with (nolock) on m.fspro_userid = tm.teamMemberUserId where t.ownerId = and t.fsl_tablecode = --and m.fspro_userid in ( 3271440 ) --and m.fspro_userid in ( 3460387 ) select territoryId subjectId, 'TER' subjectType from tbl_TER_Territories t with (nolock) where t.ownerId = and t.fsl_tablecode =
							qmd_factCheckers.recordCount = #qmd_factCheckers.recordCount#
							qmd_subjects.recordCount = #qmd_subjects.recordCount#
						
update tbl_DW_Timeframes set updateTimestamp = , updateSeconds = where timeframeId =
select * from qmd_results order by name asc

Total Processing Time: #_totalRunTime#