-- Licensed Materials - Property of IBM
--
-- BI and PM: CM
--
-- (C) Copyright IBM Corp. 2008, 2009
--
-- US Government Users Restricted Rights - Use, duplication or disclosure
-- restricted by GSA ADP Schedule Contract with IBM Corp.

-- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
-- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).


CREATE TABLE CMOBJPROPS67 (
	CMID			number(10) NOT NULL,
	NONPEAKDEMANDBGNH	number(10) NULL,
	PEAKDEMANDBEGINH	number(10) NULL,
	ASPEAKCONS		number(10) NULL,
	BRSPEAKAFFINECONS	number(10) NULL,
	BRSPEAKMAXPROCS		number(10) NULL,
	BRSPEAKNONAFFCONS	number(10) NULL,
	CMSPEAKCONS		number(10) NULL,
	DDSPEAKCONS		number(10) NULL,
	DISPEAKCONS		number(10) NULL,
	DMSPEAKCONS		number(10) NULL,
	DSPEAKCONS		number(10) NULL,
	IDSPEAKCONS		number(10) NULL,
	ISSPEAKCONS		number(10) NULL,
	IUSPEAKCONS		number(10) NULL,
	JSPEAKCONS		number(10) NULL,
	MBSPEAKCONS		number(10) NULL,			
	MISPEAKCONS		number(10) NULL,
	MMSPEAKCONS		number(10) NULL,
	PACSPEAKCONS		number(10) NULL,
	PDSPEAKCONS		number(10) NULL,
	PDSPEAKMAXPROCS		number(10) NULL,
	PPSPEAKAFFINECONS	number(10) NULL,
	PPSPEAKNONAFFCONS	number(10) NULL,
	PRSPEAKCONS		number(10) NULL,
	PTSPEAKCONS		number(10) NULL,
	RSPEAKAFFINECONS	number(10) NULL,
	RSPEAKMAXPROCS		number(10) NULL,
	RSPEAKNONAFFCONS	number(10) NULL,
	constraint PK_CMOBJPROPS67 primary key (CMID) 
);

insert into CMOBJPROPS67(CMID) SELECT CMID FROM CMOBJECTS WHERE CLASSID IN (65, 4, 34, 47, 155, 177, 170, 171, 172, 176, 25, 199, 83, 84, 99, 88, 164, 165, 166, 186, 189, 191);

insert into CMOBJPROPS67 (CMID, NONPEAKDEMANDBGNH, PEAKDEMANDBEGINH) select o.PCMID, a.NEWNONPEAKBEGINHOUR, a.NEWPEAKBEGINHOUR from CMOBJECTS o left outer join CMOBJPROPS17 a on a.CMID = o.CMID where o.CLASSID = 92;

insert into CMOBJPROPS67 (CMID) select CMID from CMOBJECTS where CLASSID = 14 and CMID not in (select CMID from CMOBJPROPS67);

update CMOBJPROPS67 set NONPEAKDEMANDBGNH = (select NEWNONPEAKBEGINHOUR from CMOBJPROPS17 where CMOBJPROPS67.CMID = CMID) where NONPEAKDEMANDBGNH is null;

update CMOBJPROPS67 set PEAKDEMANDBEGINH = (select NEWPEAKBEGINHOUR from CMOBJPROPS17 where CMOBJPROPS67.CMID = CMID) where PEAKDEMANDBEGINH is null;

!RunCMScript CMUpgradeScript_configuration_update_14.xml