

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


-------------------------------------------------------------------------------
--	NC11_UPDATE_DB2.SQL			*	DO NOT EDIT	 *			Data Store Version: 11		 
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$100-- backup create begin
-------------------------------------------------------------------------------

CREATE TABLE BC_TASKSCHEDULE_CANCELLED_RUNS(
   FK_TASKSCHEDULE_ID 		 INTEGER NOT NULL,
   CANCELLED_DATE		 NUMERIC(14) NOT NULL
);

-------------------------------------------------------------------------------
--$110-- backup inserts begin
-------------------------------------------------------------------------------

INSERT INTO BC_TASKSCHEDULE_CANCELLED_RUNS (FK_TASKSCHEDULE_ID, CANCELLED_DATE) SELECT FK_TASKSCHEDULE_ID, CANCELLED_DATE FROM NC_TASKSCHEDULE_CANCELLED_RUNS;

-------------------------------------------------------------------------------
--$130-- views drop begin
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$140-- tables drop begin
-------------------------------------------------------------------------------

DROP TABLE NC_TASKSCHEDULE_CANCELLED_RUNS;

-------------------------------------------------------------------------------
--$200-- recreate tables begin
-------------------------------------------------------------------------------


CREATE TABLE NC_TASKSCHEDULE_CANCELLED_RUNS (
   FK_TASKSCHEDULE_ID 	 INTEGER NOT NULL,
   CANCELLED_DATE		 NUMERIC(14) NOT NULL,
   FK_SCHEDULE_ID        INTEGER,
   AUDIT_USER            VARCHAR(2000)
);

-------------------------------------------------------------------------------
--$202-- primary keys add begin
-------------------------------------------------------------------------------

CREATE INDEX I1N_CANCELLED_DATE ON NC_TASKSCHEDULE_CANCELLED_RUNS (
   FK_TASKSCHEDULE_ID);

ALTER TABLE NC_TASKSCHEDULE_CANCELLED_RUNS
   ADD CONSTRAINT PN_CANCELLED_DATES PRIMARY KEY (FK_TASKSCHEDULE_ID,CANCELLED_DATE));

-------------------------------------------------------------------------------
--$210-- views create begin
-------------------------------------------------------------------------------



-------------------------------------------------------------------------------
--$220-- server data inserts begin
-------------------------------------------------------------------------------

INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES(
   11,
   'build no.'
);

 -------------------------------------------------------------------------------
 --$230-- restore inserts begin
 -------------------------------------------------------------------------------

INSERT INTO NC_TASKSCHEDULE_CANCELLED_RUNS (FK_TASKSCHEDULE_ID, CANCELLED_DATE) SELECT FK_TASKSCHEDULE_ID, CANCELLED_DATE FROM BC_TASKSCHEDULE_CANCELLED_RUNS;
 
 -------------------------------------------------------------------------------
 --$250-- backup drop begin
 -------------------------------------------------------------------------------

DROP TABLE BC_TASKSCHEDULE_CANCELLED_RUNS;

-------------------------------------------------------------------------------
--$260-- end sql by function
-------------------------------------------------------------------------------
--	END NC11_UPDATE_DB2.SQL			*	DO NOT EDIT	 * 		 
-------------------------------------------------------------------------------
