-- 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).


drop table CMDELETEDSCHEDULES

alter table CMOBJPROPS2 drop constraint PK_CMOBJPROPS2

sp_rename 'CMOBJPROPS2', 'CMOBJPROPS2_OLD'

CREATE TABLE CMOBJPROPS2 (
	CMID			int NOT NULL ,
	TASKID		varchar (32) NULL ,
	STARTDATE		datetime NULL ,
	ENDDATE		datetime NULL ,
	ENDTYPE		tinyint NULL ,
	EVERYNPERIODS	int NULL ,
	DAILYPERIOD		tinyint NULL ,
	MONTHLYABSDAY	tinyint NULL ,
	MONTHLYRELDAY	tinyint NULL ,
	MONTHLYRELWEEK	tinyint NULL ,
	TYPE			tinyint NULL ,
	YEARLYABSDAY	tinyint NULL ,
	YEARLYABSMONTH	tinyint NULL ,
	YEARLYRELDAY	tinyint NULL ,
	YEARLYRELMONTH	tinyint NULL ,
	YEARLYRELWEEK	tinyint NULL ,
	ACTIVE		bit default(0) NOT NULL,
	WEEKLYMONDAY	bit default(0) NOT NULL ,
	WEEKLYTUESDAY	bit default(0) NOT NULL ,
	WEEKLYWEDNESDAY	bit default(0) NOT NULL ,
	WEEKLYTHURSDAY	bit default(0) NOT NULL ,
	WEEKLYFRIDAY	bit default(0) NOT NULL ,
	WEEKLYSATURDAY	bit default(0) NOT NULL ,
	WEEKLYSUNDAY	bit default(0) NOT NULL, 
	CONSTRAINT PK_CMOBJPROPS2 PRIMARY KEY (CMID) 
)

insert into CMOBJPROPS2(CMID,TASKID,STARTDATE,ENDDATE,ENDTYPE,EVERYNPERIODS,DAILYPERIOD,MONTHLYABSDAY,MONTHLYRELDAY,MONTHLYRELWEEK,TYPE,YEARLYABSDAY,YEARLYABSMONTH,YEARLYRELDAY,YEARLYRELMONTH,YEARLYRELWEEK,ACTIVE,WEEKLYMONDAY,WEEKLYTUESDAY,WEEKLYWEDNESDAY,WEEKLYTHURSDAY,WEEKLYFRIDAY,WEEKLYSATURDAY,WEEKLYSUNDAY) select CMID,TASKID,STARTDATE,ENDDATE,ENDTYPE,EVERYNPERIODS,DAILYPERIOD,MONTHLYABSDAY,MONTHLYRELDAY,MONTHLYRELWEEK,TYPE,YEARLYABSDAY,YEARLYABSMONTH,YEARLYRELDAY,YEARLYRELMONTH,YEARLYRELWEEK,ACTIVE,WEEKLYMONDAY,WEEKLYTUESDAY,WEEKLYWEDNESDAY,WEEKLYTHURSDAY,WEEKLYFRIDAY,WEEKLYSATURDAY,WEEKLYSUNDAY from CMOBJPROPS2_OLD

drop table CMOBJPROPS2_OLD

	