 WHERE c.effectiveTime >= @HISTORY_START;
 
 -- Where the concept entry in the history has no previous entry in the history, 
--- then we'll mark the status as 0 - Created.
+-- then we'll mark the status as 0 - Created.   
+-- Watch out for components that are created in an inactive state however.
 UPDATE rf21_COMPONENTHISTORY ch 
 SET CHANGETYPE=0,
-STATUS = 0
+STATUS = ( select statusFor(c.active) from rf2_concept_sv c
+			where c.id = ch.componentid
+			and c.effectiveTime = ch.releaseversion )
 WHERE isConcept = true
 AND NOT EXISTS (
 	SELECT 1 from rf2_concept_sv cf

  AND ( 
     ch.changeType > ch2.changeType
     OR (ch.changeType = ch2.changeType AND ch.status = 1 AND NOT ch2.status = 1)
     )
);

STATUS = statusFor ( select active from rf2_concept_sv c
						where ch.componentid = c.id
						and ch.releaseversion = c.effectiveTime ),
Reason =  @CS_CHANGE
WHERE EXISTS (
	SELECT 1 FROM rf2_concept_sv c2, rf2_concept_sv c3
	WHERE ch.componentid = c2.id
