

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


-------------------------------------------------------------------------------
-- NC13_UPDATE_SYBASE.SQL	       *DO NOT EDIT*		Data Store Version: 13		 
-------------------------------------------------------------------------------

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

CREATE TABLE BC_NC_SCHEDULE(
   PK_SCHEDULE_ID                INTEGER NOT NULL,
   NAME                          NVARCHAR(255) NULL,
   DESCRIPTION                   NVARCHAR(1000) NULL,
   LASTMOD_BY                    CHAR(40) NULL,
   LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
   MODCOUNT                      INTEGER DEFAULT (-1),
   SCHEDULE_TYPE                 CHAR(6) NULL,
   TIMEZONE                      VARCHAR(100) NULL,
   START_DATE                    NUMERIC NULL,
   END_DATE                      NUMERIC NULL,
   REPEAT_FOREVER                INTEGER NULL,
   ACTIVE                        INTEGER NULL,
   VALID_SCHEDULE                INTEGER NULL,
   USE_DAY_NUMBER                INTEGER NULL,
   DAY_OF_MONTH                  INTEGER NULL,
   DAY_OF_WEEK                   INTEGER NULL,
   DAY_OF_WEEK_IN_MONTH          INTEGER NULL,
   MONTH_OF_YEAR                 INTEGER NULL,
   REPEAT_INTERVAL               INTEGER NULL,
   DAYS_OF_WEEK                  INTEGER NULL,
   FIXED_INTERVAL_TYPE           INTEGER NULL,
   FIXED_INTERVAL_IN_MILLIS      NUMERIC(10) NULL
)
go

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

INSERT INTO BC_NC_SCHEDULE (
	PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,
	SCHEDULE_TYPE,TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,
	VALID_SCHEDULE,USE_DAY_NUMBER,DAY_OF_MONTH,DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,
	MONTH_OF_YEAR,REPEAT_INTERVAL,DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,
	FIXED_INTERVAL_IN_MILLIS) 
SELECT PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,
	SCHEDULE_TYPE,TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,
	VALID_SCHEDULE,USE_DAY_NUMBER,DAY_OF_MONTH,DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,
	MONTH_OF_YEAR,REPEAT_INTERVAL,DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,
	FIXED_INTERVAL_IN_MILLIS
FROM NC_SCHEDULE
go

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


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

ALTER TABLE R_TASKSCHEDULE_SCHEDULE
   DROP CONSTRAINT F2R_TASKSCHEDULE_S
go

DROP TABLE NC_SCHEDULE
go

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

CREATE TABLE NC_SCHEDULE(
   PK_SCHEDULE_ID                INTEGER NOT NULL,
   NAME                          NVARCHAR(255) NULL,
   DESCRIPTION                   NVARCHAR(1000) NULL,
   LASTMOD_BY                    CHAR(40) NULL,
   LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
   MODCOUNT                      INTEGER DEFAULT (-1),
   SCHEDULE_TYPE                 CHAR(6) NULL,
   TIMEZONE                      VARCHAR(100) NULL,
   START_DATE                    NUMERIC NULL,
   END_DATE                      NUMERIC NULL,
   REPEAT_FOREVER                INTEGER NULL,
   ACTIVE                        INTEGER NULL,
   VALID_SCHEDULE                INTEGER NULL,
   USE_DAY_NUMBER                INTEGER NULL,
   DAY_OF_MONTH                  INTEGER NULL,
   DAY_OF_WEEK                   INTEGER NULL,
   DAY_OF_WEEK_IN_MONTH          INTEGER NULL,
   MONTH_OF_YEAR                 INTEGER NULL,
   REPEAT_INTERVAL               INTEGER NULL,
   DAYS_OF_WEEK                  INTEGER NULL,
   FIXED_INTERVAL_TYPE           INTEGER NULL,
   FIXED_INTERVAL_IN_MILLIS      NUMERIC(10) NULL,
   TRIGGER_ID                    NVARCHAR(255) NULL
)
go

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

ALTER TABLE NC_SCHEDULE
   ADD CONSTRAINT PN_SCHEDULE PRIMARY KEY (PK_SCHEDULE_ID)
go

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


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

INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES(13,'build no.')
go

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

INSERT INTO NC_SCHEDULE (
	PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,
	SCHEDULE_TYPE,TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,
	VALID_SCHEDULE,USE_DAY_NUMBER,DAY_OF_MONTH,DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,
	MONTH_OF_YEAR,REPEAT_INTERVAL,DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,
	FIXED_INTERVAL_IN_MILLIS) 
SELECT PK_SCHEDULE_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,
	SCHEDULE_TYPE,TIMEZONE,START_DATE,END_DATE,REPEAT_FOREVER,ACTIVE,
	VALID_SCHEDULE,USE_DAY_NUMBER,DAY_OF_MONTH,DAY_OF_WEEK,DAY_OF_WEEK_IN_MONTH,
	MONTH_OF_YEAR,REPEAT_INTERVAL,DAYS_OF_WEEK,FIXED_INTERVAL_TYPE,
	FIXED_INTERVAL_IN_MILLIS
FROM BC_NC_SCHEDULE
go

-------------------------------------------------------------------------------
--$240-- foreign keys add begin
-------------------------------------------------------------------------------

ALTER TABLE R_TASKSCHEDULE_SCHEDULE
   ADD CONSTRAINT F2R_TASKSCHEDULE_S FOREIGN KEY (FK_SCHEDULE_ID)
      REFERENCES NC_SCHEDULE
go
 
 -------------------------------------------------------------------------------
 --$250-- backup drop begin
 -------------------------------------------------------------------------------

DROP TABLE BC_NC_SCHEDULE
go

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