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

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

CREATE TABLE NC_TASK_QUEUE (
	TASK_ID 			CHAR(45) NOT NULL,
	SERVICE_NAME 		NVARCHAR(40) NULL,
	SERVER_GROUP 		NVARCHAR(40) NULL,
	DATE_ENTERED 		NUMERIC(19)NOT NULL,
	TASK 				IMAGE NULL,
	STATUS 				INTEGER NOT NULL,
	PRIORITY 			INTEGER NOT NULL,
	RESTART_ID              CHAR(45) NULL,
	SDS_INSTANCE_ID 	CHAR (32) NULL,
	HISTORY_STORE_ID 	CHAR (34) NULL,
	ACTUAL_EXECUTION_TIME   NUMERIC(19) NULL,
	ACTUAL_COMPLETION_TIME  NUMERIC(19) NULL,
	DISPATCHER_ID		CHAR(45) NULL,
	SCHEDULE_TRIGGER_NAME   NVARCHAR(255) NULL,
	SCHEDULE_TYPE		CHAR(15) NULL,
	ACCOUNT_PATH		NVARCHAR(1024) NULL,
	STOREID 		CHAR(34) NULL,
	OBJECT_CLASS 		CHAR(64) NULL,
	OWNER_STOREID 		NVARCHAR(1024) NULL,
	PROCESS_ID          INTEGER NULL,
	TARGET_DISPATCHER_ID		CHAR(45) NULL
) lock datarows
go

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

CREATE INDEX IX_NC_TSK_Q_SLTR ON NC_TASK_QUEUE (
	STATUS, SERVICE_NAME, SERVER_GROUP, DATE_ENTERED)
go

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

ALTER TABLE NC_TASK_QUEUE ADD CONSTRAINT PN_TASK_QUEUE PRIMARY KEY (TASK_ID)
go

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

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

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

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

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

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