--    IBM Confidential
--    
--    OCO Source Materials
--    
--    BI and PM: JSM
--    
--    (c) Copyright IBM Corp. 2003, 2010
--    
--    The source code for this program is not published or otherwise divested of its trade secrets, irrespective of what has been deposited with the U.S. Copyright Office.
--

-------------------------------------------------------------------------------
-- NC837_UPDATE_IFX.SQL	       *DO NOT EDIT*		Data Store Version: 837		 
-------------------------------------------------------------------------------


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

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

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

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

DROP TABLE NC_TASK_QUEUE;

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

CREATE TABLE NC_TASK_QUEUE(
    TASK_ID CHAR(45) NOT NULL,
    SERVICE_NAME VARCHAR(40),
    SERVER_GROUP VARCHAR(40),
    DATE_ENTERED DECIMAL(19, 0) NOT NULL,
    TASK BLOB,
    STATUS INTEGER NOT NULL,
    PRIORITY INTEGER NOT NULL,
    RESTART_ID CHAR(45),
    SDS_INSTANCE_ID CHAR(32),
    HISTORY_STORE_ID CHAR(34),
    ACTUAL_EXECUTION_TIME DECIMAL(19, 0),
    ACTUAL_COMPLETION_TIME DECIMAL(19, 0),
    DISPATCHER_ID CHAR(45),
    SCHEDULE_TRIGGER_NAME VARCHAR(255),
    SCHEDULE_TYPE CHAR(15),
    ACCOUNT_PATH LVARCHAR(1024),
    STOREID CHAR(34),
    OBJECT_CLASS CHAR(64),
    OWNER_STOREID LVARCHAR(1024),
    PROCESS_ID INTEGER,
	TARGET_DISPATCHER_ID CHAR(45)
) lock mode row;


-------------------------------------------------------------------------------
--$201-- indices create begin
-------------------------------------------------------------------------------

CREATE INDEX IX_NC_TSK_Q_SLTR
    ON NC_TASK_QUEUE(STATUS,SERVICE_NAME,SERVER_GROUP,DATE_ENTERED);
	
-------------------------------------------------------------------------------
--$202-- primary keys add begin
-------------------------------------------------------------------------------

ALTER TABLE NC_TASK_QUEUE
 ADD CONSTRAINT  PRIMARY KEY(TASK_ID) CONSTRAINT PN_TASK_QUEUE;
 
-------------------------------------------------------------------------------
--$210-- views create begin
-------------------------------------------------------------------------------

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

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

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

 -------------------------------------------------------------------------------
 --$250-- backup drop begin
 -------------------------------------------------------------------------------

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