 	 OR (ch.changeType = ch2.changeType AND ch.status = 0 AND NOT ch2.status = 0)
 	 )
 );
+
+SELECT * from rf21_COMPONENTHISTORY where componentid = @COMPONENT_OF_INTEREST;

SET @CS_CHANGE = 'CONCEPTSTATUS CHANGE';
SET @PREFERRED = '900000000000548007';

SET @DESC_INACT_RS = 900000000000490003;
SET @DS_CHANGE = 'DESCRIPTIONSTATUS CHANGE';
SET @DT_CHANGE = 'DESCRIPTIONTYPE CHANGE';
SET @LC_CHANGE = 'LANGUAGECODE CHANGE';

	AND cf.effectiveTime < ch.releaseVersion
);

-- Add all Description entries from the full file - creations, activations and inactivations
INSERT INTO rf21_COMPONENTHISTORY
SELECT t.id, t.effectiveTime,  @NOT_SET,  @NOT_SET, '', FALSE, 
(	-- Work out the most recent change preceeding this change
