

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


-------------------------------------------------------------------------------
--	NC2_UPDATE_SYBASE.SQL       *  DO NOT EDIT  *       	 
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
--$100-- backup create begin
-------------------------------------------------------------------------------
 
 CREATE TABLE BC_AGENT_MESSAGE(
    LOG_ID                        INTEGER NOT NULL,
    AGENT_ID                      INTEGER NOT NULL,
    MESSAGE                       NVARCHAR(2000) NOT NULL,
    TIMESTAMP                     NUMERIC NULL
 )
 go
 
 CREATE TABLE BC_AGGREGATE_RULE_TREE(
    FK_PARENT_ID                  INTEGER NOT NULL,
    FK_CHILD_ID                   INTEGER NOT NULL
 )
 go
 
 CREATE TABLE BC_BIE(
    PK_BIE_ID                     INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_TIME                  DATETIME NULL,
    MOD_CNT                       INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL
 )
 go
 
 CREATE TABLE BC_BIECALC(
    PK_CALC_ID                    INTEGER NOT NULL,
    LHS_TOPIC_ID                  INTEGER NULL,
    TYPE_NAME                     VARCHAR(20) NULL,
    FK_RHSTYPE                    VARCHAR(20) NULL,
    OPERATOR                      CHAR(18) NULL,
    NUMERIC_LITERAL               FLOAT NULL,
    STRING_LITERAL                NVARCHAR(255) NULL,
    DATE_LITERAL                  DATETIME NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(255) NULL
 )
 go
 
 CREATE TABLE BC_BIETOPIC(
    PK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_BIE_ID                     INTEGER NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_DMT_ID                     INTEGER NULL,
    TYPE                          VARCHAR(30) NULL,
    MODCOUNT                      INTEGER NULL,
    FK_CALC_ID                    INTEGER NULL,
    FK_BIETOPIC_ID                INTEGER NULL
 )
 go
 
 CREATE TABLE BC_COGNOS_DS(
    PK_PP_DS_ID                   INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SERVER_NAME                   NVARCHAR(255) NULL,
    SECURITY_DETAILS              NVARCHAR(2000) NULL,
    PORT_NUMBER                   SMALLINT NULL
 )
 go
 
 CREATE TABLE BC_CONFIG_DS(
    PK_DS_ID                      INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    USERNAME                      NVARCHAR(32) NULL,
    PASSWORD                      NVARCHAR(32) NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
    SERVER_NAME                   NVARCHAR(50) NULL,
    SECURITY_DETAILS              VARBINARY(2000) NULL
 )
 go
 
 CREATE TABLE BC_CTMAP(
    OBJTYPE                       INTEGER NOT NULL,
    CLASS                         VARCHAR(200) NULL,
    TABLENAME                     VARCHAR(200) NOT NULL,
    HELPER                        VARCHAR(200) NULL,
    REMOTECLASS                   VARCHAR(200) NULL
 )
 go
 
 CREATE TABLE BC_DATAMAPPING(
    PK_DM_ID                      INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SQL_STRING                    TEXT NULL,
    FK_DS_ID                      INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
    FK_PPDS_ID                    INTEGER NULL,
    FK_COGNOSDS_ID                INTEGER NULL,
    URL                           VARCHAR(2024) NULL,
    NIC                           VARCHAR(2024) NULL
 )
 go
 
 CREATE TABLE BC_DB_VERSION(
    DB_VERSION_ID                 INTEGER NULL,
    BUILD                         NVARCHAR(20) NULL
 )
 go
 
 CREATE TABLE BC_DELIVERYADDRESS(
    PK_DELADDRESS_ID              INTEGER NOT NULL,
    DELIVERY_ADDRESS              NVARCHAR(100) NULL,
    CHANNEL_TYPE                  INTEGER NULL,
    IS_DEFAULT                    INTEGER NOT NULL,
    FK_RECIPIENT_ID               INTEGER NULL
 )
 go
 
 CREATE TABLE BC_DMTOPIC(
       PK_TOPIC_ID          INTEGER NOT NULL,
       NAME                 VARCHAR(255) NULL,
       DESCRIPTION          VARCHAR(2000) NULL,
       TSRC                 VARCHAR(100) NULL,
       TLINK                VARCHAR(200) NULL,
       FK_DM_ID             INTEGER NOT NULL,
       LASTMOD_BY           CHAR(40) NULL,
       LASTMOD_TIME         DATETIME DEFAULT GETDATE(),
       TABLE_NAME           VARCHAR(64) NULL,
       COLUMN_NAME          VARCHAR(64) NULL,
       DRE_COLUMN_NAME      VARCHAR(64) NULL,
       COLUMN_TYPE          INTEGER NULL,
       PP_TOPIC_VALUE       VARCHAR(255) NULL,
       PP_ROW_PATH          VARCHAR(2000) NULL,
       PP_COL_PATH          VARCHAR(2000) NULL,
       OBJ_TYPE             SMALLINT NULL
 )
 go
 
 CREATE TABLE BC_DMT_LINK(
    PK_DM_ID                      INTEGER NOT NULL,
    FK_DM_ID                      INTEGER NOT NULL,
    FK_DATAMAPPING                CHAR(40) NOT NULL
 )
 go
 
 CREATE TABLE BC_DSITEM_L1(
    PK_DSITEM1_ID                 INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_DS_ID                      INTEGER NOT NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE BC_DSITEM_L2(
    PK_DSITEM2_ID                 INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_DSITEM1_ID                 INTEGER NOT NULL,
    TYPE                          INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE BC_DSPOOL(
    PK_DSPOOL_ID                  INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    URL                           NVARCHAR(128) NOT NULL,
    DRIVER                        NVARCHAR(100) NOT NULL,
    DS_TYPE                       INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE BC_DYNAMIC_RECIPIENT_STRUCT(
    PK_ID                         INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    TITLE                         NVARCHAR(64) NULL,
    FIRSTNAME                     NVARCHAR(64) NULL,
    MIDDLENAME                    NVARCHAR(64) NULL,
    LASTNAME                      NVARCHAR(64) NULL,
    PHONENUMBER                   NVARCHAR(64) NULL,
    JOBTITLE                      NVARCHAR(64) NULL,
    COMPANYNAME                   NVARCHAR(255) NULL,
    DEPARTMENT                    NVARCHAR(255) NULL,
    OFFICE                        NVARCHAR(255) NULL,
    COUNTRY                       NVARCHAR(255) NULL,
    TIMEZONE                      NVARCHAR(64) NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    MODCOUNT                      INTEGER DEFAULT (-1)
 )
 go
 
 CREATE TABLE BC_DYN_DELIVERY_INFO_STRUCT(
    PK_OID                        INTEGER NOT NULL,
    FK_DYNAMIC_RECIPIENT_STRUCT   INTEGER NULL,
    ADDRESS_DESCRIPTION           NCHAR(40) NULL,
    CHANNEL_TYPE                  INTEGER NOT NULL,
    ADDRESS_BIE_ID                INTEGER NOT NULL,
    NAME                          NVARCHAR(100) NULL,
    LASTMOD_BY                    VARCHAR(100) NULL,
    MODCOUNT                      INTEGER DEFAULT (-1),
    DESCRIPTION                   NVARCHAR(100) NULL
 )
 go
 
 CREATE TABLE BC_EXECUTABLE(
    PK_EXE_ID                     INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER NULL,
    PATH                          NVARCHAR(255) NOT NULL,
    FK_TASK_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE BC_MACHINE_CONFIG(
    PK_OID                        INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_BY                    VARCHAR(32) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
    TIMEZONE                      NVARCHAR(50) NULL
 )
 go
 
 CREATE TABLE BC_MESSAGELINE(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    LINE_NO                       INTEGER NOT NULL,
    LINE_TYPE                     INTEGER NULL
 )
 go
 
 CREATE TABLE BC_MESSAGELINE_ELEMENT(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    ELEMENT_NUMBER                INTEGER NOT NULL,
    LINE_NO                       INTEGER NOT NULL,
    TEXT                          VARCHAR(2000) NULL,
    FK_BIE_TOPIC_ID               INTEGER NULL
 )
 go
 
 CREATE TABLE BC_MESSAGESTRUCT(
    PK_MS_ID                      INTEGER NOT NULL,
    FK_DYNREC_ID                  INTEGER NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SOURCE                        NVARCHAR(100) NULL,
    SUBJECT                       NVARCHAR(100),
    MODCOUNT                      INTEGER DEFAULT (-1),
    LASTMOD_BY                    VARCHAR(50) NULL,
    CHANNEL_TYPE                  INTEGER NULL,
    CONTACT                       NVARCHAR(50) NULL,
    AVOID_DUPLICATION             INTEGER DEFAULT (0) NOT NULL
 )
 go
 
 CREATE TABLE BC_MESSAGE_ATTACHMENT(
    PK_ATTACHMENT_ID              INTEGER NOT NULL,
    FK_MESSAGE_ID                 INTEGER NOT NULL,
    ATTACHMENT_TYPE               INTEGER NOT NULL,
    ATTACHMENT                    VARCHAR(100) NOT NULL,
    ATTACHMENT_SERVER             VARCHAR(100) NULL,
    MIME_TYPE                     VARCHAR(100) NOT NULL
 )
 go
 
 CREATE TABLE BC_MSGDUPLICATION_STORE(
    MSG_PART_ID                   NUMERIC NOT NULL,
    TOPIC_STRING_VALUE            NVARCHAR(2000) NULL,
    FK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NULL,
    DATE_                         DATETIME DEFAULT GETDATE() NOT NULL
 )
 go
 
 CREATE TABLE BC_MSGDUPLICATION_TEMP_STORE(
    MSG_PART_ID                   NUMERIC NOT NULL,
    TOPIC_STRING_VALUE            NVARCHAR(2000) NULL,
    FK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NULL,
    SESSION_ID                    NUMERIC NOT NULL
 )
 go
 
 CREATE TABLE BC_OBJECTCATALOGUE(
    PK_OID                        INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SUBTYPE                       SMALLINT NULL,
    TYPE                          INTEGER NOT NULL,
    MODCOUNT                      INTEGER DEFAULT (-1)
 )
 go
 
 CREATE TABLE BC_OBJECTID(
    OBJECTID                      INTEGER
 )
 go
 
 CREATE TABLE BC_OBJECT_PERMISSIONS(
    FK_OID                        INTEGER NOT NULL,
    PERMISSION                    INTEGER NOT NULL,
    ACL                           NCHAR(50) NOT NULL
 )
 go
 
 CREATE TABLE BC_PERMISSION(
    PK_PERMISSION_ID              INTEGER NOT NULL,
    DESCRIPTION                   VARCHAR(30) NOT NULL
 )
 go
 
 CREATE TABLE BC_RECIPIENT(
    PK_RECIPIENT_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),
    TITLE                         NVARCHAR(10) NULL,
    FIRSTNAME                     NVARCHAR(50) NULL,
    MIDDLENAME                    NVARCHAR(50) NULL,
    LASTNAME                      NVARCHAR(50) NULL,
    PHONENUMBER                   NVARCHAR(50) NULL,
    JOBTITLE                      NVARCHAR(50) NULL,
    COMPANY                       NVARCHAR(255) NULL,
    DEPARTMENT                    NVARCHAR(255) NULL,
    OFFICE                        NVARCHAR(255) NULL,
    COUNTRY                       NVARCHAR(50) NULL,
    TIMEZONE                      NVARCHAR(50) NULL,
    TO_REDIRECT                   INTEGER NOT NULL,
    FK_REDIRECT_RID               INTEGER NULL,
    FK_REDIRECT_RGID              INTEGER NULL,
    IS_EXTERNAL                   INTEGER NULL,
    IS_USEDEFAULTADDRESS          INTEGER NULL
 )
 go
 
 CREATE TABLE BC_RECIPIENTSCHEDULE(
    PK_SCHEDULE_ID                INTEGER NOT NULL,
    SCHEDULE_NAME                 NVARCHAR(100) NULL,
    FK_RECIPIENT_ID               INTEGER NULL,
    DELIVERY_SCHEDULE             NVARCHAR(2000) NULL,
    FK_DELADDRESS_ID              INTEGER NULL
 )
 go
 
 CREATE TABLE BC_RULE(
    PK_RULE_ID                    INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_RULETYPE                   VARCHAR(20) NULL,
    FK_RHSTYPE                    VARCHAR(30) NULL,
    FK_BIE_ID                     INTEGER NULL,
    LHS_TOPIC_ID                  INTEGER NULL,
    OPERATOR                      VARCHAR(30) NULL,
    DATE_LITERAL                  DATETIME NULL,
    STRING_LITERAL                NVARCHAR(255) NULL,
    RHS_TOPIC_ID                  INTEGER NULL,
    RHS_OPTION                    NUMERIC NULL,
    NUMERIC_LITERAL               FLOAT NULL,
    RHS_BIE_ID                    INTEGER NULL
 )
 go
 
 CREATE TABLE BC_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,
    EXECUTE_FIRST                 VARCHAR(100) NULL,
    END_AT                        VARCHAR(100) 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,
    START_TIME_STRING             VARCHAR(50) NULL,
    START_DATE_STRING             VARCHAR(50) NULL,
    END_DATE_STRING               VARCHAR(50) 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,
    ESCALATION_SCHEDULE           INTEGER NULL,
    DAYS_OF_WEEK                  INTEGER NULL,
    FIXED_INTERVAL_TYPE           INTEGER NULL,
    FIXED_INTERVAL_IN_MILLIS      NUMERIC(10) NULL
 )
 go
 
 CREATE TABLE BC_TASK(
    PK_TASK_ID                    INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_BIE_ID                     INTEGER NULL,
    THRESHOLD                     INTEGER NULL,
    WEIGHTS                       NVARCHAR(200) NULL,
    TASK_TYPE                     INTEGER NULL,
    DATEFORMAT                    CHAR(19) NULL,
    DETECTION_OPTION              INTEGER NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE(),
    MODCOUNT                      INTEGER DEFAULT (-1),
    LASTMOD_BY                    CHAR(40) NULL
 )
 go
 
 CREATE TABLE BC_TASKSCHEDULE(
    PK_TASKSCHEDULE_ID            INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    MODCOUNT                      INTEGER DEFAULT (-1) NOT NULL,
    RUN_REQUIREMENTS              INTEGER NULL,
    LAST_EXECUTION_AT             NUMERIC NULL,
    NEXT_EXECUTION_REQUEST        NUMERIC NULL,
    SCHEDULE_DELAY                NUMERIC NULL
 )
 go
 
 CREATE TABLE BC_TASK_LOG(
    LOG_ID                        INTEGER NOT NULL,
    TASK_NAME                     NVARCHAR(255) NOT NULL,
    TASK_ID                       INTEGER NULL,
    REQUIRED_RUN_TIME             NUMERIC NULL,
    ACTUAL_RUN_TIME               NUMERIC NULL,
    NEXT_RUN_TIME                 NUMERIC NULL,
    FINAL_STATE                   INTEGER NOT NULL
 )
 go
 
 CREATE TABLE BC_USER_SESSION(
    TICKET_ID                     NVARCHAR(32) NOT NULL,
    NC_USER_ID                    INTEGER NOT NULL,
    USER_CLASS                    NCHAR(50) NOT NULL
 )
 go
 
 CREATE TABLE B_AGENT_ESCALATIONAGENT(
    FK_CHILD_AGENT_ID             INTEGER NOT NULL,
    FK_PARENT_AGENT_ID            INTEGER NOT NULL
 )
 go
 
 CREATE TABLE B_BIECALC_RHSTOPIC(
    FK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_CALC_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE B_DS_MACHINE_DSPOOL(
    PK_DSMAC_ID                   INTEGER NOT NULL,
    FK_DSPOOL_ID                  INTEGER NOT NULL,
    FK_MACHINE_ID                 INTEGER NOT NULL,
    FK_CONFIG_DS_ID               INTEGER NOT NULL,
    LASTMOD_BY                    VARCHAR(32) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE B_MESSAGESTRUCT_TASK(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE B_MSGSTRUCT_AVOIDTOPICS(
    FK_MS_ID                      INTEGER NOT NULL,
    FK_BIETOPIC_ID                INTEGER NOT NULL
 )
 go
 
 CREATE TABLE B_MSGSTRUCT_RECIPIENT_DELIVINF(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_DELIVERY_INFO_ID           INTEGER NULL,
    FK_RECIPIENT_ID               INTEGER NOT NULL,
    ADDED_BY_RECIP_ID             INTEGER NULL
 )
 go
 
 CREATE TABLE B_NEWSITEMS_NCOBJECTS(
    FK_NCID                       INTEGER NOT NULL,
    NID                           NCHAR(32) NOT NULL,
    VID                           NCHAR(32) NULL,
    TYPE                          SMALLINT NULL
 )
 go
 
 CREATE TABLE B_RECIPIENT_ACCMANUSERID(
    F_RECIPIENTID                 INTEGER NOT NULL,
    ACCMAN_UID                    NUMERIC NOT NULL
 )
 go
 
 CREATE TABLE B_RULE_PARAMETER(
    FK_TASK_ID                    INTEGER NOT NULL,
    LITERAL_TYPE                  NVARCHAR(200) NULL,
    FK_RULE_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE B_TASKSCHEDULE_SCHEDULE(
    FK_TASKSCHEDULE_ID            INTEGER NOT NULL,
    FK_SCHEDULE_ID                INTEGER NOT NULL,
    IS_ACTIVE                     INTEGER NULL,
    IS_ESCALATION                 INTEGER
 )
 go

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

INSERT INTO BC_AGENT_MESSAGE (LOG_ID,AGENT_ID,MESSAGE,TIMESTAMP) SELECT LOG_ID,AGENT_ID,MESSAGE,TIMESTAMP FROM NC_AGENT_MESSAGE
 go
  
 INSERT INTO BC_AGGREGATE_RULE_TREE (FK_PARENT_ID,FK_CHILD_ID) SELECT FK_PARENT_ID,FK_CHILD_ID FROM NC_AGGREGATE_RULE_TREE
 go
  
 INSERT INTO BC_BIE (PK_BIE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,LASTMOD_BY) SELECT PK_BIE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,LASTMOD_BY FROM NC_BIE
 go
  
 INSERT INTO BC_BIECALC (PK_CALC_ID,LHS_TOPIC_ID,TYPE_NAME,FK_RHSTYPE,OPERATOR,NUMERIC_LITERAL,STRING_LITERAL,DATE_LITERAL,NAME,DESCRIPTION) SELECT PK_CALC_ID,LHS_TOPIC_ID,TYPE_NAME,FK_RHSTYPE,OPERATOR,NUMERIC_LITERAL,STRING_LITERAL,DATE_LITERAL,NAME,DESCRIPTION FROM NC_BIECALC
 go
  
 INSERT INTO BC_BIETOPIC (PK_BIETOPIC_ID,FK_BIE_ID,NAME,DESCRIPTION,FK_DMT_ID,TYPE,MODCOUNT,FK_CALC_ID,FK_BIETOPIC_ID) SELECT PK_BIETOPIC_ID,FK_BIE_ID,NAME,DESCRIPTION,FK_DMT_ID,TYPE,MODCOUNT,FK_CALC_ID,FK_BIETOPIC_ID FROM NC_BIETOPIC
 go
  
 INSERT INTO BC_COGNOS_DS (PK_PP_DS_ID,NAME,DESCRIPTION,SERVER_NAME,SECURITY_DETAILS,PORT_NUMBER) SELECT PK_PP_DS_ID,NAME,DESCRIPTION,SERVER_NAME,SECURITY_DETAILS,PORT_NUMBER FROM NC_COGNOS_DS
 go
  
 INSERT INTO BC_CONFIG_DS (PK_DS_ID,NAME,DESCRIPTION,USERNAME,PASSWORD,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,SERVER_NAME,SECURITY_DETAILS) SELECT PK_DS_ID,NAME,DESCRIPTION,USERNAME,PASSWORD,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,SERVER_NAME,SECURITY_DETAILS FROM NC_CONFIG_DS
 go
  
 INSERT INTO BC_DATAMAPPING (PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL,NIC) SELECT PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL,NIC FROM NC_DATAMAPPING
 go
  
 INSERT INTO BC_DB_VERSION (DB_VERSION_ID,BUILD) SELECT DB_VERSION_ID,BUILD FROM NC_DB_VERSION
 go
  
 INSERT INTO BC_DELIVERYADDRESS (PK_DELADDRESS_ID,DELIVERY_ADDRESS,CHANNEL_TYPE,IS_DEFAULT,FK_RECIPIENT_ID) SELECT PK_DELADDRESS_ID,DELIVERY_ADDRESS,CHANNEL_TYPE,IS_DEFAULT,FK_RECIPIENT_ID FROM NC_DELIVERYADDRESS
 go
  
 INSERT INTO BC_DMTOPIC (PK_TOPIC_ID,NAME,DESCRIPTION,TSRC,TLINK,FK_DM_ID,LASTMOD_BY,LASTMOD_TIME,TABLE_NAME,COLUMN_NAME,DRE_COLUMN_NAME,COLUMN_TYPE,PP_TOPIC_VALUE,OBJ_TYPE) SELECT PK_TOPIC_ID,NAME,DESCRIPTION,TSRC,TLINK,FK_DM_ID,LASTMOD_BY,LASTMOD_TIME,TABLE_NAME,COLUMN_NAME,DRE_COLUMN_NAME,COLUMN_TYPE,PP_TOPIC_VALUE,OBJ_TYPE FROM NC_DMTOPIC
 go
  
 INSERT INTO BC_DMT_LINK (PK_DM_ID,FK_DM_ID,FK_DATAMAPPING) SELECT PK_DM_ID,FK_DM_ID,FK_DATAMAPPING FROM NC_DMT_LINK
 go
  
 INSERT INTO BC_DSITEM_L1 (PK_DSITEM1_ID,NAME,DESCRIPTION,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSITEM1_ID,NAME,DESCRIPTION,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM NC_DSITEM_L1
 go
  
 INSERT INTO BC_DSITEM_L2 (PK_DSITEM2_ID,NAME,DESCRIPTION,FK_DSITEM1_ID,TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSITEM2_ID,NAME,DESCRIPTION,FK_DSITEM1_ID,TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM NC_DSITEM_L2
 go
  
 INSERT INTO BC_DSPOOL (PK_DSPOOL_ID,NAME,DESCRIPTION,URL,DRIVER,DS_TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSPOOL_ID,NAME,DESCRIPTION,URL,DRIVER,DS_TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM NC_DSPOOL
 go
  
 INSERT INTO BC_DYNAMIC_RECIPIENT_STRUCT (PK_ID,NAME,DESCRIPTION,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANYNAME,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,LASTMOD_BY,MODCOUNT) SELECT PK_ID,NAME,DESCRIPTION,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANYNAME,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,LASTMOD_BY,MODCOUNT FROM NC_DYNAMIC_RECIPIENT_STRUCT
 go
  
 INSERT INTO BC_DYN_DELIVERY_INFO_STRUCT (PK_OID,FK_DYNAMIC_RECIPIENT_STRUCT,ADDRESS_DESCRIPTION,CHANNEL_TYPE,ADDRESS_BIE_ID,NAME,LASTMOD_BY,MODCOUNT,DESCRIPTION) SELECT PK_OID,FK_DYNAMIC_RECIPIENT_STRUCT,ADDRESS_DESCRIPTION,CHANNEL_TYPE,ADDRESS_BIE_ID,NAME,LASTMOD_BY,MODCOUNT,DESCRIPTION FROM NC_DYN_DELIVERY_INFO_STRUCT
 go
  
 INSERT INTO BC_EXECUTABLE (PK_EXE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,PATH,FK_TASK_ID) SELECT PK_EXE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,PATH,FK_TASK_ID FROM NC_EXECUTABLE
 go
  
 INSERT INTO BC_MACHINE_CONFIG (PK_OID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,TIMEZONE) SELECT PK_OID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,TIMEZONE FROM NC_MACHINE_CONFIG
 go
  
 INSERT INTO BC_MESSAGELINE (FK_MESSAGESTRUCT_ID,LINE_NO,LINE_TYPE) SELECT FK_MESSAGESTRUCT_ID,LINE_NO,LINE_TYPE FROM NC_MESSAGELINE
 go
  
 INSERT INTO BC_MESSAGELINE_ELEMENT (FK_MESSAGESTRUCT_ID,ELEMENT_NUMBER,LINE_NO,TEXT,FK_BIE_TOPIC_ID) SELECT FK_MESSAGESTRUCT_ID,ELEMENT_NUMBER,LINE_NO,TEXT,FK_BIE_TOPIC_ID FROM NC_MESSAGELINE_ELEMENT
 go
  
 INSERT INTO BC_MESSAGESTRUCT (PK_MS_ID,FK_DYNREC_ID,NAME,DESCRIPTION,SOURCE,SUBJECT,MODCOUNT,LASTMOD_BY,CHANNEL_TYPE,CONTACT,AVOID_DUPLICATION) SELECT PK_MS_ID,FK_DYNREC_ID,NAME,DESCRIPTION,SOURCE,SUBJECT,MODCOUNT,LASTMOD_BY,CHANNEL_TYPE,CONTACT,AVOID_DUPLICATION FROM NC_MESSAGESTRUCT
 go
  
 INSERT INTO BC_MESSAGE_ATTACHMENT (PK_ATTACHMENT_ID,FK_MESSAGE_ID,ATTACHMENT_TYPE,ATTACHMENT,ATTACHMENT_SERVER,MIME_TYPE) SELECT PK_ATTACHMENT_ID,FK_MESSAGE_ID,ATTACHMENT_TYPE,ATTACHMENT,ATTACHMENT_SERVER,MIME_TYPE FROM NC_MESSAGE_ATTACHMENT
 go
  
 INSERT INTO BC_MSGDUPLICATION_STORE (MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,DATE_) SELECT MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,DATE_ FROM NC_MSGDUPLICATION_STORE
 go
  
 INSERT INTO BC_MSGDUPLICATION_TEMP_STORE (MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,SESSION_ID) SELECT MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,SESSION_ID FROM NC_MSGDUPLICATION_TEMP_STORE
 go
  
 INSERT INTO BC_OBJECTCATALOGUE (PK_OID,NAME,DESCRIPTION,SUBTYPE,TYPE,MODCOUNT) SELECT PK_OID,NAME,DESCRIPTION,SUBTYPE,TYPE,MODCOUNT FROM NC_OBJECTCATALOGUE
 go
  
 INSERT INTO BC_OBJECTID (OBJECTID) SELECT OBJECTID FROM NC_OBJECTID
 go
  
 INSERT INTO BC_OBJECT_PERMISSIONS (FK_OID,PERMISSION,ACL) SELECT FK_OID,PERMISSION,ACL FROM NC_OBJECT_PERMISSIONS
 go
  
 INSERT INTO BC_RECIPIENT (PK_RECIPIENT_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANY,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,TO_REDIRECT,FK_REDIRECT_RID,FK_REDIRECT_RGID,IS_EXTERNAL,IS_USEDEFAULTADDRESS) SELECT PK_RECIPIENT_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANY,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,TO_REDIRECT,FK_REDIRECT_RID,FK_REDIRECT_RGID,IS_EXTERNAL,IS_USEDEFAULTADDRESS FROM NC_RECIPIENT
 go
  
 INSERT INTO BC_RECIPIENTSCHEDULE (PK_SCHEDULE_ID,SCHEDULE_NAME,FK_RECIPIENT_ID,DELIVERY_SCHEDULE,FK_DELADDRESS_ID) SELECT PK_SCHEDULE_ID,SCHEDULE_NAME,FK_RECIPIENT_ID,DELIVERY_SCHEDULE,FK_DELADDRESS_ID FROM NC_RECIPIENTSCHEDULE
 go
  
 INSERT INTO BC_RULE (PK_RULE_ID,NAME,DESCRIPTION,FK_RULETYPE,FK_RHSTYPE,FK_BIE_ID,LHS_TOPIC_ID,OPERATOR,DATE_LITERAL,STRING_LITERAL,RHS_TOPIC_ID,RHS_OPTION,NUMERIC_LITERAL,RHS_BIE_ID) SELECT PK_RULE_ID,NAME,DESCRIPTION,FK_RULETYPE,FK_RHSTYPE,FK_BIE_ID,LHS_TOPIC_ID,OPERATOR,DATE_LITERAL,STRING_LITERAL,RHS_TOPIC_ID,RHS_OPTION,NUMERIC_LITERAL,RHS_BIE_ID FROM NC_RULE
 go
  
 INSERT INTO BC_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
  
 INSERT INTO BC_TASK (PK_TASK_ID,NAME,DESCRIPTION,FK_BIE_ID,THRESHOLD,WEIGHTS,TASK_TYPE,DATEFORMAT,DETECTION_OPTION,LASTMOD_TIME,MODCOUNT,LASTMOD_BY) SELECT PK_TASK_ID,NAME,DESCRIPTION,FK_BIE_ID,THRESHOLD,WEIGHTS,TASK_TYPE,DATEFORMAT,DETECTION_OPTION,LASTMOD_TIME,MODCOUNT,LASTMOD_BY FROM NC_TASK
 go
  
 INSERT INTO BC_TASKSCHEDULE (PK_TASKSCHEDULE_ID,FK_TASK_ID,NAME,DESCRIPTION,LASTMOD_BY,MODCOUNT,RUN_REQUIREMENTS,LAST_EXECUTION_AT,NEXT_EXECUTION_REQUEST,SCHEDULE_DELAY) SELECT PK_TASKSCHEDULE_ID,FK_TASK_ID,NAME,DESCRIPTION,LASTMOD_BY,MODCOUNT,RUN_REQUIREMENTS,LAST_EXECUTION_AT,NEXT_EXECUTION_REQUEST,SCHEDULE_DELAY FROM NC_TASKSCHEDULE
 go
  
 INSERT INTO BC_TASK_LOG (LOG_ID,TASK_NAME,TASK_ID,REQUIRED_RUN_TIME,ACTUAL_RUN_TIME,NEXT_RUN_TIME,FINAL_STATE) SELECT LOG_ID,TASK_NAME,TASK_ID,REQUIRED_RUN_TIME,ACTUAL_RUN_TIME,NEXT_RUN_TIME,FINAL_STATE FROM NC_TASK_LOG
 go
  
 INSERT INTO BC_USER_SESSION (TICKET_ID,NC_USER_ID,USER_CLASS) SELECT TICKET_ID,NC_USER_ID,USER_CLASS FROM NC_USER_SESSION
 go
  
 INSERT INTO B_AGENT_ESCALATIONAGENT (FK_CHILD_AGENT_ID,FK_PARENT_AGENT_ID) SELECT FK_CHILD_AGENT_ID,FK_PARENT_AGENT_ID FROM R_AGENT_ESCALATIONAGENT
 go
  
 INSERT INTO B_BIECALC_RHSTOPIC (FK_BIETOPIC_ID,FK_CALC_ID) SELECT FK_BIETOPIC_ID,FK_CALC_ID FROM R_BIECALC_RHSTOPIC
 go
  
 INSERT INTO B_DS_MACHINE_DSPOOL (PK_DSMAC_ID,FK_DSPOOL_ID,FK_MACHINE_ID,FK_CONFIG_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSMAC_ID,FK_DSPOOL_ID,FK_MACHINE_ID,FK_CONFIG_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM R_DS_MACHINE_DSPOOL
 go
  
 INSERT INTO B_MESSAGESTRUCT_TASK (FK_MESSAGESTRUCT_ID,FK_TASK_ID) SELECT FK_MESSAGESTRUCT_ID,FK_TASK_ID FROM R_MESSAGESTRUCT_TASK
 go
  
 INSERT INTO B_MSGSTRUCT_AVOIDTOPICS (FK_MS_ID,FK_BIETOPIC_ID) SELECT FK_MS_ID,FK_BIETOPIC_ID FROM R_MSGSTRUCT_AVOIDTOPICS
 go
  
 INSERT INTO B_MSGSTRUCT_RECIPIENT_DELIVINF (FK_MESSAGESTRUCT_ID,FK_DELIVERY_INFO_ID,FK_RECIPIENT_ID,ADDED_BY_RECIP_ID) SELECT FK_MESSAGESTRUCT_ID,FK_DELIVERY_INFO_ID,FK_RECIPIENT_ID,ADDED_BY_RECIP_ID FROM R_MSGSTRUCT_RECIPIENT_DELIVINF
 go
  
 INSERT INTO B_NEWSITEMS_NCOBJECTS (FK_NCID,NID,VID,TYPE) SELECT FK_NCID,NID,VID,TYPE FROM R_NEWSITEMS_NCOBJECTS
 go
  
 INSERT INTO B_RECIPIENT_ACCMANUSERID (F_RECIPIENTID,ACCMAN_UID) SELECT F_RECIPIENTID,ACCMAN_UID FROM R_RECIPIENT_ACCMANUSERID
 go
  
 INSERT INTO B_RULE_PARAMETER (FK_TASK_ID,LITERAL_TYPE,FK_RULE_ID) SELECT FK_TASK_ID,LITERAL_TYPE,FK_RULE_ID FROM R_RULE_PARAMETER
 go
  
 INSERT INTO B_TASKSCHEDULE_SCHEDULE (FK_TASKSCHEDULE_ID,FK_SCHEDULE_ID,IS_ACTIVE,IS_ESCALATION) SELECT FK_TASKSCHEDULE_ID,FK_SCHEDULE_ID,IS_ACTIVE,IS_ESCALATION FROM R_TASKSCHEDULE_SCHEDULE
 go
 
 -------------------------------------------------------------------------------
 --$120-- foreign keys drop begin
 -------------------------------------------------------------------------------

 ALTER TABLE NC_AGGREGATE_RULE_TREE DROP CONSTRAINT CF1_NC_AGGREGATE_RULE_TREE 
 go
 ALTER TABLE NC_AGGREGATE_RULE_TREE DROP CONSTRAINT CF2_NC_AGGREGATE_RULE_TREE 
 go
 ALTER TABLE NC_BIETOPIC DROP CONSTRAINT CF1_NC_BIETOPIC 
 go
 ALTER TABLE NC_BIETOPIC DROP CONSTRAINT CF2_NC_BIETOPIC 
 go
 ALTER TABLE NC_DATAMAPPING DROP CONSTRAINT CF2_DATAMAPPING 
 go
 ALTER TABLE NC_DATAMAPPING DROP CONSTRAINT CF1_NC_DATAMAPPING 
 go
 ALTER TABLE NC_DYN_DELIVERY_INFO_STRUCT DROP CONSTRAINT CF1_NC_DYN_DELIVERY_INFO_STRUCT 
 go
 ALTER TABLE NC_EXECUTABLE DROP CONSTRAINT CF1_NC_EXECUTABLE 
 go
 ALTER TABLE NC_MESSAGELINE DROP CONSTRAINT CF1_NC_MESSAGELINE 
 go
 ALTER TABLE NC_MESSAGELINE_ELEMENT DROP CONSTRAINT CF1_NC_MESSAGELINE_ELEMENT 
 go
 ALTER TABLE NC_MESSAGESTRUCT DROP CONSTRAINT CF1_NC_MESSAGESTRUCT 
 go
 ALTER TABLE NC_MESSAGE_ATTACHMENT DROP CONSTRAINT CF1_NC_MESSAGE_ATTACHMENT 
 go
 ALTER TABLE NC_TASKSCHEDULE DROP CONSTRAINT CF1_NC_TASKSCHEDULE 
 go
 ALTER TABLE R_AGENT_ESCALATIONAGENT DROP CONSTRAINT CF1_R_AGENT_ESCALATIONAGENT 
 go
 ALTER TABLE R_DS_MACHINE_DSPOOL DROP CONSTRAINT CF1_R_DS_MACHINE_DSPOOL 
 go
 ALTER TABLE R_DS_MACHINE_DSPOOL DROP CONSTRAINT CF2_R_DS_MACHINE_DSPOOL 
 go
 ALTER TABLE R_MESSAGESTRUCT_TASK DROP CONSTRAINT CF1_R_MESSAGESTRUCT_TASK 
 go
 ALTER TABLE R_MESSAGESTRUCT_TASK DROP CONSTRAINT CF2_R_MESSAGESTRUCT_TASK 
 go
 ALTER TABLE R_MSGSTRUCT_AVOIDTOPICS DROP CONSTRAINT CF1_R_MSGSTRUCT_AVOIDTOPICS 
 go
 ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF DROP CONSTRAINT CF1_R_MSGSTRUCT_RECIPIENT_DELIVINF 
 go
 ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF DROP CONSTRAINT CF2_R_MSGSTRUCT_RECIPIENT_DELIVINF 
 go
 ALTER TABLE R_RECIPIENT_ACCMANUSERID DROP CONSTRAINT CF1_R_RECIPIENT_ACCMANUSERID 
 go
 ALTER TABLE R_RULE_PARAMETER DROP CONSTRAINT CF1_R_RULE_PARAMETER 
 go
 ALTER TABLE R_TASKSCHEDULE_SCHEDULE DROP CONSTRAINT CF1_R_TASKSCHEDULE_SCHEDULE 
 go
 ALTER TABLE R_TASKSCHEDULE_SCHEDULE DROP CONSTRAINT CF2_R_TASKSCHEDULE_SCHEDULE 
 go
 
-------------------------------------------------------------------------------
--$130-- views drop begin
-------------------------------------------------------------------------------
 
 DROP VIEW V_NC_TASK_LINK
 go
 
 DROP VIEW V_BIECALC_LINK
 go
 
 DROP VIEW V_BIE_COMPLETE
 go
 
 DROP VIEW V_NC_AGENT_LOG
 go

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

 DROP TABLE NC_AGENT_MESSAGE
 go
 
 DROP TABLE NC_AGGREGATE_RULE_TREE
 go
 
 DROP TABLE NC_BIE
 go
 
 DROP TABLE NC_BIECALC
 go
 
 DROP TABLE NC_BIETOPIC
 go
 
 DROP TABLE NC_COGNOS_DS
 go
 
 DROP TABLE NC_CONFIG_DS
 go
 
 DROP TABLE NC_CTMAP
 go
 
 DROP TABLE NC_DATAMAPPING
 go
 
 DROP TABLE NC_DB_VERSION
 go
 
 DROP TABLE NC_DELIVERYADDRESS
 go
 
 DROP TABLE NC_DMTOPIC
 go
 
 DROP TABLE NC_DMT_LINK
 go
 
 DROP TABLE NC_DSITEM_L1
 go
 
 DROP TABLE NC_DSITEM_L2
 go
 
 DROP TABLE NC_DSPOOL
 go
 
 DROP TABLE NC_DYNAMIC_RECIPIENT_STRUCT
 go
 
 DROP TABLE NC_DYN_DELIVERY_INFO_STRUCT
 go
 
 DROP TABLE NC_EXECUTABLE
 go
 
 DROP TABLE NC_MACHINE_CONFIG
 go
 
 DROP TABLE NC_MESSAGELINE
 go
 
 DROP TABLE NC_MESSAGELINE_ELEMENT
 go
 
 DROP TABLE NC_MESSAGESTRUCT
 go
 
 DROP TABLE NC_MESSAGE_ATTACHMENT
 go
 
 DROP TABLE NC_MSGDUPLICATION_STORE
 go
 
 DROP TABLE NC_MSGDUPLICATION_TEMP_STORE
 go
 
 DROP TABLE NC_OBJECTCATALOGUE
 go
 
 DROP TABLE NC_OBJECTID
 go
 
 DROP TABLE NC_OBJECT_PERMISSIONS
 go
 
 DROP TABLE NC_PERMISSION
 go
 
 DROP TABLE NC_RECIPIENT
 go
 
 DROP TABLE NC_RECIPIENTSCHEDULE
 go
 
 DROP TABLE NC_RULE
 go
 
 DROP TABLE NC_SCHEDULE
 go
 
 DROP TABLE NC_TASK
 go
 
 DROP TABLE NC_TASKSCHEDULE
 go
 
 DROP TABLE NC_TASK_LOG
 go
 
 DROP TABLE NC_USER_SESSION
 go
 
 DROP TABLE R_AGENT_ESCALATIONAGENT
 go
 
 DROP TABLE R_BIECALC_RHSTOPIC
 go
 
 DROP TABLE R_DS_MACHINE_DSPOOL
 go
 
 DROP TABLE R_MESSAGESTRUCT_TASK
 go
 
 DROP TABLE R_MSGSTRUCT_AVOIDTOPICS
 go
 
 DROP TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
 go
 
 DROP TABLE R_NEWSITEMS_NCOBJECTS
 go
 
 DROP TABLE R_RECIPIENT_ACCMANUSERID
 go
 
 DROP TABLE R_RULE_PARAMETER
 go
 
 DROP TABLE R_TASKSCHEDULE_SCHEDULE
 go
 
 
-------------------------------------------------------------------------------
--$200-- recreate tables begin
-------------------------------------------------------------------------------

 
 CREATE TABLE NC_ADMINISTRATOR(
    USER_CLASS                    NCHAR(50) NOT NULL
 )
 go
 
 CREATE TABLE NC_AGENT_MESSAGE(
    LOG_ID                        INTEGER NOT NULL,
    AGENT_ID                      INTEGER NOT NULL,
    MESSAGE                       NVARCHAR(2000) NOT NULL,
    TIMESTAMP                     NUMERIC NULL
 )
 go
 
 CREATE TABLE NC_AGGREGATE_RULE_TREE(
    FK_PARENT_ID                  INTEGER NOT NULL,
    FK_CHILD_ID                   INTEGER NOT NULL
 )
 go
 
 CREATE TABLE NC_BIE(
    PK_BIE_ID                     INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_TIME                  DATETIME NULL,
    MOD_CNT                       INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL
 )
 go
 
 CREATE TABLE NC_BIECALC(
    PK_CALC_ID                    INTEGER NOT NULL,
    LHS_TOPIC_ID                  INTEGER NULL,
    TYPE_NAME                     VARCHAR(20) NULL,
    FK_RHSTYPE                    VARCHAR(20) NULL,
    OPERATOR                      CHAR(18) NULL,
    NUMERIC_LITERAL               FLOAT NULL,
    STRING_LITERAL                NVARCHAR(255) NULL,
    DATE_LITERAL                  DATETIME NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(255) NULL
 )
 go
 
 CREATE TABLE NC_BIETOPIC(
    PK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_BIE_ID                     INTEGER NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_DMT_ID                     INTEGER NULL,
    TYPE                          VARCHAR(30) NULL,
    MODCOUNT                      INTEGER NULL,
    FK_CALC_ID                    INTEGER NULL,
    FK_BIETOPIC_ID                INTEGER NULL
 )
 go
 
 CREATE TABLE NC_COGNOS_DS(
    PK_PP_DS_ID                   INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SERVER_NAME                   NVARCHAR(255) NULL,
    SECURITY_DETAILS              NVARCHAR(2000) NULL,
    PORT_NUMBER                   SMALLINT NULL
 )
 go
 
 CREATE TABLE NC_CONFIG_DS(
    PK_DS_ID                      INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    USERNAME                      NVARCHAR(32) NULL,
    PASSWORD                      NVARCHAR(32) NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
    SERVER_NAME                   NVARCHAR(50) NULL,
    SECURITY_DETAILS              VARBINARY(2000) NULL
 )
 go
 
 CREATE TABLE NC_CTMAP(
    OBJTYPE                       INTEGER NOT NULL,
    CLASS                         VARCHAR(200) NULL,
    TABLENAME                     VARCHAR(200) NOT NULL,
    HELPER                        VARCHAR(200) NULL,
    REMOTECLASS                   VARCHAR(200) NULL
 )
 go
 
 CREATE TABLE NC_DATAMAPPING(
    PK_DM_ID                      INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SQL_STRING                    TEXT NULL,
    FK_DS_ID                      INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
    FK_PPDS_ID                    INTEGER NULL,
    FK_COGNOSDS_ID                INTEGER NULL,
    URL                           VARCHAR(2024) NULL,
    NIC                           VARCHAR(2024) NULL
 )
 go
 
 CREATE TABLE NC_DB_VERSION(
    DB_VERSION_ID                 INTEGER NULL,
    BUILD                         NVARCHAR(20) NULL
 )
 go
 
 CREATE TABLE NC_DELIVERYADDRESS(
    PK_DELADDRESS_ID              INTEGER NOT NULL,
    DELIVERY_ADDRESS              NVARCHAR(100) NULL,
    CHANNEL_TYPE                  INTEGER NULL,
    IS_DEFAULT                    INTEGER NOT NULL,
    FK_RECIPIENT_ID               INTEGER NULL
 )
 go
 
 CREATE TABLE NC_DMTOPIC(
    PK_TOPIC_ID                   INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    TSRC                          VARCHAR(100) NULL,
    TLINK                         VARCHAR(200) NULL,
    FK_DM_ID                      INTEGER NOT NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE(),
    TABLE_NAME                    NVARCHAR(64) NULL,
    COLUMN_NAME                   NVARCHAR(64) NULL,
    DRE_COLUMN_NAME               NVARCHAR(64) NULL,
    COLUMN_TYPE                   INTEGER NULL,
    PP_TOPIC_VALUE                VARCHAR(255) NULL,
    OBJ_TYPE                      SMALLINT NULL
 )
 go
 
 CREATE TABLE NC_DMT_LINK(
    PK_DM_ID                      INTEGER NOT NULL,
    FK_DM_ID                      INTEGER NOT NULL,
    FK_DATAMAPPING                CHAR(40) NOT NULL
 )
 go
 
 CREATE TABLE NC_DSITEM_L1(
    PK_DSITEM1_ID                 INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_DS_ID                      INTEGER NOT NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE NC_DSITEM_L2(
    PK_DSITEM2_ID                 INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_DSITEM1_ID                 INTEGER NOT NULL,
    TYPE                          INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE NC_DSPOOL(
    PK_DSPOOL_ID                  INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    URL                           NVARCHAR(128) NOT NULL,
    DRIVER                        NVARCHAR(100) NOT NULL,
    DS_TYPE                       INTEGER NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE NC_DYNAMIC_RECIPIENT_STRUCT(
    PK_ID                         INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    TITLE                         NVARCHAR(64) NULL,
    FIRSTNAME                     NVARCHAR(64) NULL,
    MIDDLENAME                    NVARCHAR(64) NULL,
    LASTNAME                      NVARCHAR(64) NULL,
    PHONENUMBER                   NVARCHAR(64) NULL,
    JOBTITLE                      NVARCHAR(64) NULL,
    COMPANYNAME                   NVARCHAR(255) NULL,
    DEPARTMENT                    NVARCHAR(255) NULL,
    OFFICE                        NVARCHAR(255) NULL,
    COUNTRY                       NVARCHAR(255) NULL,
    TIMEZONE                      NVARCHAR(64) NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    MODCOUNT                      INTEGER DEFAULT (-1)
 )
 go
 
 CREATE TABLE NC_DYN_DELIVERY_INFO_STRUCT(
    PK_OID                        INTEGER NOT NULL,
    FK_DYNAMIC_RECIPIENT_STRUCT   INTEGER NULL,
    ADDRESS_DESCRIPTION           NCHAR(40) NULL,
    CHANNEL_TYPE                  INTEGER NOT NULL,
    ADDRESS_BIE_ID                INTEGER NOT NULL,
    NAME                          NVARCHAR(100) NULL,
    LASTMOD_BY                    VARCHAR(100) NULL,
    MODCOUNT                      INTEGER DEFAULT (-1),
    DESCRIPTION                   NVARCHAR(100) NULL
 )
 go
 
 CREATE TABLE NC_EXECUTABLE(
    PK_EXE_ID                     INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER NULL,
    PATH                          NVARCHAR(255) NOT NULL,
    FK_TASK_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE NC_MACHINE_CONFIG(
    PK_OID                        INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_BY                    VARCHAR(32) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL,
    TIMEZONE                      NVARCHAR(50) NULL
 )
 go
 
 CREATE TABLE NC_MESSAGELINE(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    LINE_NO                       INTEGER NOT NULL,
    LINE_TYPE                     INTEGER NULL
 )
 go
 
 CREATE TABLE NC_MESSAGELINE_ELEMENT(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    ELEMENT_NUMBER                INTEGER NOT NULL,
    LINE_NO                       INTEGER NOT NULL,
    TEXT                          NVARCHAR(2000) NULL,
    FK_BIE_TOPIC_ID               INTEGER NULL
 )
 go
 
 CREATE TABLE NC_MESSAGESTRUCT(
    PK_MS_ID                      INTEGER NOT NULL,
    FK_DYNREC_ID                  INTEGER NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SOURCE                        NVARCHAR(100) NULL,
    SUBJECT                       NVARCHAR(100) NULL,
    MODCOUNT                      INTEGER DEFAULT (-1),
    LASTMOD_BY                    VARCHAR(50) NULL,
    CHANNEL_TYPE                  INTEGER NULL,
    CONTACT                       NVARCHAR(50) NULL,
    AVOID_DUPLICATION             INTEGER DEFAULT (0) NOT NULL
 )
 go
 
 CREATE TABLE NC_MESSAGE_ATTACHMENT(
    PK_ATTACHMENT_ID              INTEGER NOT NULL,
    FK_MESSAGE_ID                 INTEGER NOT NULL,
    ATTACHMENT_TYPE               INTEGER NOT NULL,
    ATTACHMENT                    VARCHAR(100) NOT NULL,
    ATTACHMENT_SERVER             VARCHAR(100) NULL,
    MIME_TYPE                     VARCHAR(100) NOT NULL
 )
 go
 
 CREATE TABLE NC_MSGDUPLICATION_STORE(
    MSG_PART_ID                   NUMERIC NOT NULL,
    TOPIC_STRING_VALUE            NVARCHAR(2000) NULL,
    FK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NULL,
    DATE_                         DATETIME DEFAULT GETDATE() NOT NULL
 )
 go
 
 CREATE TABLE NC_MSGDUPLICATION_TEMP_STORE(
    MSG_PART_ID                   NUMERIC NOT NULL,
    TOPIC_STRING_VALUE            NVARCHAR(2000) NULL,
    FK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NULL,
    SESSION_ID                    NUMERIC NOT NULL
 )
 go
 
 CREATE TABLE NC_OBJECTCATALOGUE(
    PK_OID                        INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    SUBTYPE                       SMALLINT NULL,
    TYPE                          INTEGER NOT NULL,
    MODCOUNT                      INTEGER DEFAULT (-1)
 )
 go
 
 CREATE TABLE NC_OBJECTID(
    OBJECTID                      INTEGER
 )
 go
 
 CREATE TABLE NC_OBJECT_PERMISSIONS(
    FK_OID                        INTEGER NOT NULL,
    PERMISSION                    INTEGER NOT NULL,
    ACL                           NCHAR(50) NOT NULL
 )
 go
 
 CREATE TABLE NC_PERMISSION(
    PK_PERMISSION_ID              INTEGER NOT NULL,
    DESCRIPTION                   VARCHAR(30) NOT NULL
 )
 go
 
 CREATE TABLE NC_RECIPIENT(
    PK_RECIPIENT_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),
    TITLE                         NVARCHAR(10) NULL,
    FIRSTNAME                     NVARCHAR(50) NULL,
    MIDDLENAME                    NVARCHAR(50) NULL,
    LASTNAME                      NVARCHAR(50) NULL,
    PHONENUMBER                   NVARCHAR(50) NULL,
    JOBTITLE                      NVARCHAR(50) NULL,
    COMPANY                       NVARCHAR(255) NULL,
    DEPARTMENT                    NVARCHAR(255) NULL,
    OFFICE                        NVARCHAR(255) NULL,
    COUNTRY                       NVARCHAR(50) NULL,
    TIMEZONE                      NVARCHAR(50) NULL,
    TO_REDIRECT                   INTEGER NOT NULL,
    FK_REDIRECT_RID               INTEGER NULL,
    FK_REDIRECT_RGID              INTEGER,
    IS_EXTERNAL                   INTEGER,
    IS_USEDEFAULTADDRESS          INTEGER NULL
 )
 go
 
 CREATE TABLE NC_RECIPIENTSCHEDULE(
    PK_SCHEDULE_ID                INTEGER NOT NULL,
    SCHEDULE_NAME                 NVARCHAR(100) NULL,
    FK_RECIPIENT_ID               INTEGER NULL,
    DELIVERY_SCHEDULE             NVARCHAR(2000) NULL,
    FK_DELADDRESS_ID              INTEGER NULL
 )
 go
 
 CREATE TABLE NC_RULE(
    PK_RULE_ID                    INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NOT NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_RULETYPE                   VARCHAR(20) NULL,
    FK_RHSTYPE                    VARCHAR(30) NULL,
    FK_BIE_ID                     INTEGER NULL,
    LHS_TOPIC_ID                  INTEGER NULL,
    OPERATOR                      VARCHAR(30) NULL,
    DATE_LITERAL                  DATETIME NULL,
    STRING_LITERAL                NVARCHAR(255) NULL,
    RHS_TOPIC_ID                  INTEGER NULL,
    RHS_OPTION                    NUMERIC NULL,
    NUMERIC_LITERAL               FLOAT NULL,
    RHS_BIE_ID                    INTEGER NULL
 )
 go
 
 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
 )
 go
 
 CREATE TABLE NC_TASK(
    PK_TASK_ID                    INTEGER NOT NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    FK_BIE_ID                     INTEGER NULL,
    THRESHOLD                     INTEGER NULL,
    WEIGHTS                       NVARCHAR(200) NULL,
    TASK_TYPE                     INTEGER NULL,
    DATEFORMAT                    CHAR(19) NULL,
    DETECTION_OPTION              INTEGER NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE(),
    MODCOUNT                      INTEGER DEFAULT (-1),
    LASTMOD_BY                    CHAR(40) NULL
 )
 go
 
 CREATE TABLE NC_TASKSCHEDULE(
    PK_TASKSCHEDULE_ID            INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NULL,
    NAME                          NVARCHAR(255) NULL,
    DESCRIPTION                   NVARCHAR(1000) NULL,
    LASTMOD_BY                    CHAR(40) NULL,
    MODCOUNT                      INTEGER DEFAULT (-1) NOT NULL,
    RUN_REQUIREMENTS              INTEGER NULL,
    LAST_EXECUTION_AT             NUMERIC NULL,
    NEXT_EXECUTION_REQUEST        NUMERIC NULL,
    SCHEDULE_DELAY                NUMERIC NULL
 )
 go
 
 CREATE TABLE NC_TASK_LOG(
    LOG_ID                        INTEGER NOT NULL,
    TASK_NAME                     NVARCHAR(255) NOT NULL,
    TASK_ID                       INTEGER NULL,
    REQUIRED_RUN_TIME             NUMERIC NULL,
    ACTUAL_RUN_TIME               NUMERIC NULL,
    NEXT_RUN_TIME                 NUMERIC NULL,
    FINAL_STATE                   INTEGER NOT NULL
 )
 go
 
 CREATE TABLE NC_USER_SESSION(
    TICKET_ID                     NVARCHAR(32) NOT NULL,
    NC_USER_ID                    INTEGER NOT NULL,
    USER_CLASS                    NCHAR(50) NOT NULL
 )
 go
 
 CREATE TABLE R_AGENT_ESCALATIONAGENT(
    FK_CHILD_AGENT_ID             INTEGER NOT NULL,
    FK_PARENT_AGENT_ID            INTEGER NOT NULL
 )
 go
 
 CREATE TABLE R_BIECALC_RHSTOPIC(
    FK_BIETOPIC_ID                INTEGER NOT NULL,
    FK_CALC_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE R_DS_MACHINE_DSPOOL(
    PK_DSMAC_ID                   INTEGER NOT NULL,
    FK_DSPOOL_ID                  INTEGER NOT NULL,
    FK_MACHINE_ID                 INTEGER NOT NULL,
    FK_CONFIG_DS_ID               INTEGER NOT NULL,
    LASTMOD_BY                    VARCHAR(32) NULL,
    LASTMOD_TIME                  DATETIME DEFAULT GETDATE() NOT NULL,
    MOD_CNT                       INTEGER DEFAULT (-1) NOT NULL
 )
 go
 
 CREATE TABLE R_MESSAGESTRUCT_TASK(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_TASK_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE R_MSGSTRUCT_AVOIDTOPICS(
    FK_MS_ID                      INTEGER NOT NULL,
    FK_BIETOPIC_ID                INTEGER NOT NULL
 )
 go
 
 CREATE TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF(
    FK_MESSAGESTRUCT_ID           INTEGER NOT NULL,
    FK_DELIVERY_INFO_ID           INTEGER NULL,
    FK_RECIPIENT_ID               INTEGER NOT NULL,
    ADDED_BY_RECIP_ID             INTEGER NULL
 )
 go
 
 CREATE TABLE R_NEWSITEMS_NCOBJECTS(
    FK_NCID                       INTEGER NOT NULL,
    NID                           NCHAR(32) NOT NULL,
    VID                           NCHAR(32) NULL,
    TYPE                          SMALLINT NULL
 )
 go
 
 CREATE TABLE R_RECIPIENT_ACCMANUSERID(
    F_RECIPIENTID                 INTEGER NOT NULL,
    ACCMAN_UID                    NUMERIC NOT NULL
 )
 go
 
 CREATE TABLE R_RULE_PARAMETER(
    FK_TASK_ID                    INTEGER NOT NULL,
    LITERAL_TYPE                  NVARCHAR(200) NULL,
    FK_RULE_ID                    INTEGER NOT NULL
 )
 go
 
 CREATE TABLE R_TASKSCHEDULE_SCHEDULE(
    FK_TASKSCHEDULE_ID            INTEGER NOT NULL,
    FK_SCHEDULE_ID                INTEGER NOT NULL,
    IS_ACTIVE                     INTEGER NULL,
    IS_ESCALATION                 INTEGER NULL
 )
 go
 
-------------------------------------------------------------------------------
--$201-- indices create begin
-------------------------------------------------------------------------------

 CREATE INDEX I1N_MESSAGELINE_EL ON NC_MESSAGELINE_ELEMENT (
    FK_MESSAGESTRUCT_ID)
 go
 
 CREATE INDEX I2N_MESSAGELINE_EL ON NC_MESSAGELINE_ELEMENT (
    LINE_NO,FK_MESSAGESTRUCT_ID)
 go
 
 CREATE INDEX I1R_NEWSITEMS_NCOB ON R_NEWSITEMS_NCOBJECTS (
    TYPE,VID,NID)
 go
 
-------------------------------------------------------------------------------
--$202-- primary keys add begin
-------------------------------------------------------------------------------

 ALTER TABLE NC_AGENT_MESSAGE
    ADD CONSTRAINT PN_AGENT_MESSAGE PRIMARY KEY (AGENT_ID,LOG_ID)
 go
 
 ALTER TABLE NC_AGGREGATE_RULE_TREE
    ADD CONSTRAINT PN_AGGREGATE_RULE_ PRIMARY KEY (FK_CHILD_ID,FK_PARENT_ID)
 go
 
 ALTER TABLE NC_BIE
    ADD CONSTRAINT PN_BIE PRIMARY KEY (PK_BIE_ID)
 go
 
 ALTER TABLE NC_BIECALC
    ADD CONSTRAINT PN_BIECALC PRIMARY KEY (PK_CALC_ID)
 go
 
 ALTER TABLE NC_BIETOPIC
    ADD CONSTRAINT PN_BIETOPIC PRIMARY KEY (PK_BIETOPIC_ID)
 go
 
 ALTER TABLE NC_COGNOS_DS
    ADD CONSTRAINT PN_COGNOS_DS PRIMARY KEY (PK_PP_DS_ID)
 go
 
 ALTER TABLE NC_CONFIG_DS
    ADD CONSTRAINT PN_CONFIG_DS PRIMARY KEY (PK_DS_ID)
 go
 
 ALTER TABLE NC_CTMAP
    ADD CONSTRAINT PN_CTMAP PRIMARY KEY (OBJTYPE)
 go
 
 ALTER TABLE NC_DATAMAPPING
    ADD CONSTRAINT PN_DATAMAPPING PRIMARY KEY (PK_DM_ID)
 go
 
 ALTER TABLE NC_DELIVERYADDRESS
    ADD CONSTRAINT PN_DELIVERYADDRESS PRIMARY KEY (PK_DELADDRESS_ID)
 go
 
 ALTER TABLE NC_DMTOPIC
    ADD CONSTRAINT PN_DMTOPIC PRIMARY KEY (PK_TOPIC_ID)
 go
 
 ALTER TABLE NC_DSITEM_L1
    ADD CONSTRAINT PN_DSITEM_L1 PRIMARY KEY (PK_DSITEM1_ID)
 go
 
 ALTER TABLE NC_DSITEM_L2
    ADD CONSTRAINT PN_DSITEM_L2 PRIMARY KEY (PK_DSITEM2_ID)
 go
 
 ALTER TABLE NC_DSPOOL
    ADD CONSTRAINT PN_DSPOOL PRIMARY KEY (PK_DSPOOL_ID)
 go
 
 ALTER TABLE NC_DYNAMIC_RECIPIENT_STRUCT
    ADD CONSTRAINT PN_DYNAMIC_RECIPIE PRIMARY KEY (PK_ID)
 go
 
 ALTER TABLE NC_DYN_DELIVERY_INFO_STRUCT
    ADD CONSTRAINT PN_DYN_DELIVERY_IN PRIMARY KEY (PK_OID)
 go
 
 ALTER TABLE NC_EXECUTABLE
    ADD CONSTRAINT PN_EXECUTABLE PRIMARY KEY (PK_EXE_ID)
 go
 
 ALTER TABLE NC_MACHINE_CONFIG
    ADD CONSTRAINT PN_MACHINE_CONFIG PRIMARY KEY (PK_OID)
 go
 
 ALTER TABLE NC_MESSAGELINE
    ADD CONSTRAINT PN_MESSAGELINE PRIMARY KEY (LINE_NO,FK_MESSAGESTRUCT_ID)
 go
 
 ALTER TABLE NC_MESSAGELINE_ELEMENT
    ADD CONSTRAINT PN_MESSAGELINE_ELE PRIMARY KEY (LINE_NO,ELEMENT_NUMBER,FK_MESSAGESTRUCT_ID)
 go
 
 ALTER TABLE NC_MESSAGESTRUCT
    ADD CONSTRAINT PN_MESSAGESTRUCT PRIMARY KEY (PK_MS_ID)
 go
 
 ALTER TABLE NC_OBJECTCATALOGUE
    ADD CONSTRAINT PN_OBJECTCATALOGUE PRIMARY KEY (PK_OID)
 go
 
 ALTER TABLE NC_OBJECT_PERMISSIONS
    ADD CONSTRAINT PN_OBJECT_PERMISSI PRIMARY KEY (ACL,PERMISSION,FK_OID)
 go
 
 ALTER TABLE NC_PERMISSION
    ADD CONSTRAINT PN_PERMISSION PRIMARY KEY (PK_PERMISSION_ID)
 go
 
 ALTER TABLE NC_RECIPIENT
    ADD CONSTRAINT PN_RECIPIENT PRIMARY KEY (PK_RECIPIENT_ID)
 go
 
 ALTER TABLE NC_RECIPIENTSCHEDULE
    ADD CONSTRAINT PN_RECIPIENTSCHEDU PRIMARY KEY (PK_SCHEDULE_ID)
 go
 
 ALTER TABLE NC_RULE
    ADD CONSTRAINT PN_RULE PRIMARY KEY (PK_RULE_ID)
 go
 
 ALTER TABLE NC_SCHEDULE
    ADD CONSTRAINT PN_SCHEDULE PRIMARY KEY (PK_SCHEDULE_ID)
 go
 
 ALTER TABLE NC_TASK
    ADD CONSTRAINT PN_TASK PRIMARY KEY (PK_TASK_ID)
 go
 
 ALTER TABLE NC_TASKSCHEDULE
    ADD CONSTRAINT PN_TASKSCHEDULE PRIMARY KEY (PK_TASKSCHEDULE_ID)
 go
 
 ALTER TABLE NC_TASK_LOG
    ADD CONSTRAINT PN_TASK_LOG PRIMARY KEY (LOG_ID)
 go
 
 ALTER TABLE NC_USER_SESSION
    ADD CONSTRAINT PN_USER_SESSION PRIMARY KEY (USER_CLASS,NC_USER_ID,TICKET_ID)
 go
 
 ALTER TABLE R_AGENT_ESCALATIONAGENT
    ADD CONSTRAINT PR_AGENT_ESCALATIO PRIMARY KEY (FK_PARENT_AGENT_ID,FK_CHILD_AGENT_ID)
 go
 
 ALTER TABLE R_MESSAGESTRUCT_TASK
    ADD CONSTRAINT PR_MESSAGESTRUCT_T PRIMARY KEY (FK_TASK_ID,FK_MESSAGESTRUCT_ID)
 go
 
 ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
    ADD CONSTRAINT PR_MSGSTRUCT_RECIP PRIMARY KEY (FK_RECIPIENT_ID,FK_MESSAGESTRUCT_ID)
 go
 
 ALTER TABLE R_NEWSITEMS_NCOBJECTS
    ADD CONSTRAINT PR_NEWSITEMS_NCOBJ PRIMARY KEY (FK_NCID,NID)
 go
 
 ALTER TABLE R_RECIPIENT_ACCMANUSERID
    ADD CONSTRAINT PR_RECIPIENT_ACCMA PRIMARY KEY (ACCMAN_UID,F_RECIPIENTID)
 go
 
 ALTER TABLE R_TASKSCHEDULE_SCHEDULE
    ADD CONSTRAINT PR_TASKSCHEDULE_SC PRIMARY KEY (FK_SCHEDULE_ID,FK_TASKSCHEDULE_ID)
 go
 
-------------------------------------------------------------------------------
--$210-- views create begin
-------------------------------------------------------------------------------

 
 CREATE VIEW V_NC_TASK_LINK
 AS
 SELECT NC_TASK.PK_TASK_ID, NC_TASK.NAME, 
     NC_TASK.DESCRIPTION, 
     NC_OBJECTCATALOGUE.SUBTYPE AS AGENT_SUBTYPE, 
     NC_OBJECTCATALOGUE.TYPE AS AGENT_TYPE, 
     NC_TASK.FK_BIE_ID, NC_TASK.THRESHOLD, 
     NC_TASK.WEIGHTS, NC_TASK.TASK_TYPE, 
     NC_TASK.DATEFORMAT, NC_TASK.DETECTION_OPTION, 
     NC_TASK.LASTMOD_TIME, NC_TASK.MODCOUNT, 
     NC_TASK.LASTMOD_BY, 
     NC_TASKSCHEDULE.PK_TASKSCHEDULE_ID, 
     R_MESSAGESTRUCT_TASK.FK_MESSAGESTRUCT_ID, 
     R_AGENT_ESCALATIONAGENT.FK_CHILD_AGENT_ID, 
     R_RULE_PARAMETER.LITERAL_TYPE, 
     R_RULE_PARAMETER.FK_RULE_ID, 
     NC_RULE.FK_RULETYPE
 FROM NC_TASKSCHEDULE RIGHT OUTER JOIN
     NC_TASK INNER JOIN
     NC_OBJECTCATALOGUE ON 
     NC_TASK.PK_TASK_ID = NC_OBJECTCATALOGUE.PK_OID LEFT OUTER
      JOIN
     R_MESSAGESTRUCT_TASK ON 
     NC_TASK.PK_TASK_ID = R_MESSAGESTRUCT_TASK.FK_TASK_ID
      LEFT OUTER JOIN
     R_AGENT_ESCALATIONAGENT ON 
     NC_TASK.PK_TASK_ID = R_AGENT_ESCALATIONAGENT.FK_PARENT_AGENT_ID
      LEFT OUTER JOIN
     R_RULE_PARAMETER ON 
     NC_TASK.PK_TASK_ID = R_RULE_PARAMETER.FK_TASK_ID ON
      NC_TASKSCHEDULE.FK_TASK_ID = NC_TASK.PK_TASK_ID LEFT
      OUTER JOIN
     NC_RULE ON 
     R_RULE_PARAMETER.FK_RULE_ID = NC_RULE.PK_RULE_ID
 go
 
 
 
 
 CREATE VIEW V_BIECALC_LINK AS
 SELECT
  CALC.*,
  LINK.FK_BIETOPIC_ID
 FROM
  NC_BIECALC CALC LEFT JOIN
    R_BIECALC_RHSTOPIC LINK
 ON
  CALC.PK_CALC_ID = LINK.FK_CALC_ID
 go
 
 
 CREATE VIEW V_BIE_COMPLETE
 AS
 SELECT 
     NC_BIE.PK_BIE_ID AS BIE_PK_ID,   
     NC_BIETOPIC.FK_BIE_ID AS BIETOPIC_FK_BIE_ID, 
     NC_BIETOPIC.FK_CALC_ID AS BIETOPIC_FK_CALC_ID, 
     V_BIECALC_LINK.PK_CALC_ID AS CALC_LINK_PK_ID,   
     NC_BIE.NAME AS BIE_NAME, 
     NC_BIE.DESCRIPTION AS BIE_DESCRIPTION, 
     NC_BIE.MOD_CNT AS BIE_MODCOUNT,   
     NC_BIETOPIC.NAME AS BIETOPIC_NAME, 
     NC_BIETOPIC.DESCRIPTION AS BIETOPIC_DESCRIPTION, 
     NC_BIETOPIC.PK_BIETOPIC_ID AS BIETOPIC_PK_ID, 
     NC_BIETOPIC.TYPE AS BIETOPIC_TYPE, 
     NC_BIETOPIC.MODCOUNT AS BIETOPIC_MODCOUNT, 
     NC_BIETOPIC.FK_DMT_ID AS BIETOPIC_FK_DMT_ID, 
     NC_DMTOPIC.OBJ_TYPE AS TOPIC_OBJ_TYPE, 
     NC_DMTOPIC.PK_TOPIC_ID AS DMT_PK_ID, 
     NC_DMTOPIC.NAME AS DMT_NAME, 
     NC_DMTOPIC.DESCRIPTION AS DMT_DESCRIPTION, 
     NC_DMTOPIC.COLUMN_NAME AS DMT_COLUMN_NAME, 
     NC_DMTOPIC.DRE_COLUMN_NAME AS DMT_DRE_COLUMN_NAME,
     NC_DMTOPIC.TABLE_NAME AS DMT_TABLE_NAME, 
     NC_DMTOPIC.COLUMN_TYPE AS DMT_COLUMN_TYPE, 
     NC_DMTOPIC.FK_DM_ID AS DMT_FK_DM_ID, 
     NC_DMTOPIC.PP_TOPIC_VALUE AS DMT_PP_VALUE,
     V_BIECALC_LINK.NAME AS CALC_LINK_NAME,    
     V_BIECALC_LINK.DESCRIPTION AS CALC_LINK_DESCRIPTION, 
     V_BIECALC_LINK.LHS_TOPIC_ID AS CALC_LINK_LHS_TOPIC_ID,
     V_BIECALC_LINK.FK_RHSTYPE AS CALC_LINK_FK_RHSTYPE, 
     V_BIECALC_LINK.OPERATOR AS CALC_LINK_OPERATOR, 
     V_BIECALC_LINK.NUMERIC_LITERAL AS CALC_LINK_NUMERIC_LITERAL,
     V_BIECALC_LINK.STRING_LITERAL AS CALC_LINK_STRING_LITERAL,
     V_BIECALC_LINK.DATE_LITERAL AS CALC_LINK_DATE_LITERAL,
     V_BIECALC_LINK.FK_BIETOPIC_ID AS CALC_LINK_FK_BIETOPIC_ID,
     NC_RULE.FK_BIE_ID AS RULE_FK_BIE_ID, 
     NC_RULE.PK_RULE_ID AS RULE_PK_ID, 
     NC_RULE.NAME AS RULE_NAME, 
     NC_RULE.DESCRIPTION AS RULE_DESCRIPTION, 
     NC_RULE.FK_RULETYPE AS RULE_FK_RULETYPE, 
     NC_RULE.DATE_LITERAL AS RULE_DATE_LITERAL, 
     NC_RULE.STRING_LITERAL AS RULE_STRING_LITERAL, 
     NC_RULE.NUMERIC_LITERAL AS RULE_NUMERIC_LITERAL, 
     NC_RULE.LHS_TOPIC_ID AS RULE_LHS_TOPIC_ID, 
     NC_RULE.OPERATOR AS RULE_OPERATOR, 
     NC_RULE.FK_RHSTYPE AS RULE_FK_RHSTYPE, 
     NC_RULE.RHS_TOPIC_ID AS RULE_RHS_TOPIC_ID, 
     NC_RULE.RHS_OPTION AS RULE_RHS_OPTION, 
     NC_RULE.RHS_BIE_ID AS RULE_RHS_BIE_ID
 FROM 
 	 V_BIECALC_LINK 
 	 	RIGHT OUTER JOIN
     		NC_BIETOPIC ON 
     			V_BIECALC_LINK.PK_CALC_ID = NC_BIETOPIC.FK_CALC_ID 
     				RIGHT	OUTER JOIN    				
     NC_BIE 
     	LEFT OUTER JOIN
     		NC_RULE ON 
     			NC_BIE.PK_BIE_ID = NC_RULE.FK_BIE_ID ON 
     				NC_BIETOPIC.FK_BIE_ID = NC_BIE.PK_BIE_ID 
     					LEFT OUTER JOIN
     						NC_DMTOPIC ON 
     							NC_BIETOPIC.FK_DMT_ID = NC_DMTOPIC.PK_TOPIC_ID
 go
 
 
 
 
 CREATE VIEW V_NC_AGENT_LOG AS SELECT     
 	NC_TASK_LOG.LOG_ID,
 	NC_TASK.NAME AS AGENT_NAME, 
 	NC_TASK.PK_TASK_ID as AGENT_ID,   
 	NC_TASK_LOG.REQUIRED_RUN_TIME,  
 	NC_TASK_LOG.ACTUAL_RUN_TIME, 
 	NC_TASK_LOG.NEXT_RUN_TIME, 
 	NC_TASK_LOG.FINAL_STATE AS FINAL_STATUS, 
 	NC_AGENT_MESSAGE.TIMESTAMP AS MESSAGE_LOG_TIME, 
 	NC_AGENT_MESSAGE.MESSAGE
 FROM NC_TASK LEFT OUTER JOIN
 	NC_TASK_LOG ON NC_TASK.PK_TASK_ID = NC_TASK_LOG.TASK_ID 
 LEFT OUTER JOIN
 	NC_AGENT_MESSAGE ON NC_TASK_LOG.LOG_ID = NC_AGENT_MESSAGE.LOG_ID
 go	
 
 
-------------------------------------------------------------------------------
--$220-- server data inserts begin
-------------------------------------------------------------------------------

 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    110,
    'noticecast.logictier.datasource.JDBCDataSourceImpl',
    'NC_CONFIG_DS',
    'noticecast.datatier.datasource.JDBCDhJDBCDataSourceImpl',
    'noticecast.logictier.datasource.JDBCDataSourceRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    111,
    'noticecast.logictier.datasource.MachineImpl',
    'NC_MACHINE_CONFIG',
    'noticecast.datatier.datasource.JDBCDhMachine',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    112,
    'noticecast.logictier.datasource.DsPool',
    'NC_DSPOOL',
    'noticecast.datatier.datasource.JDBCDhDsPool',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    115,
    'noticecast.logictier.datasource.cognos.CognosDataSourceImpl',
    'NC_COGNOS_DS',
    'noticecast.datatier.datasource.cognos.JDBCDhCognosDataSource',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    200,
    'noticecast.logictier.datamapping.JDBCDataMappingImpl',
    'NCDataMapping',
    'noticecast.datatier.datamapping.JDBCDhJDBCDataMapping',
    'noticecast.logictier.datamapping.JDBCDataMappingRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    210,
    'noticecast.logictier.datamapping.JDBCDataMappingTopicImpl',
    'NC_DMTOPIC',
    'noticecast.datatier.datamapping.JDBCDhJDBCDataMappingTopic',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    220,
    'noticecast.logictier.datamapping.powerplay.PPDataMappingImpl',
    'NC_DATAMAPPING',
    'noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMapping',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    221,
    'noticecast.logictier.datamapping.powerplay.PPCellImpl',
    'NC_DMTOPIC',
    'noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMappingTopic',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    222,
    'noticecast.logictier.datamapping.powerplay.PPCellImpl',
    'NC_DMTOPIC',
    'noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMappingTopic',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    223,
    'noticecast.logictier.datamapping.powerplay.PPTopicImpl',
    'NC_DMTOPIC',
    'noticecast.datatier.datamapping.powerplay.JDBCDhPPDataMappingTopic',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    230,
    'noticecast.logictier.datamapping.cognosquery.CQDataMappingImpl',
    'NC_DATAMAPPING',
    'noticecast.datatier.datamapping.cognosquery.JDBCDhCQDataMapping',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    231,
    'noticecast.logictier.datamapping.cognosquery.CQTopicImpl',
    'NC_DMTOPIC',
    'noticecast.datatier.datamapping.cognosquery.JDBCDhCQDataMappingTopic',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    300,
    'noticecast.logictier.bie.BusinessInfoEntityImpl',
    'NC_BIE',
    'noticecast.datatier.bie.JDBCDhBusinessInfoEntityImpl',
    'noticecast.logictier.bie.BusinessInfoEntityRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    301,
    'noticecast.logictier.bie.BusinessInfoEntityImpl',
    'NC_COGNOS_BIE',
    'noticecast.datatier.bie.JDBCDhBusinessInfoEntityImpl',
    'noticecast.logictier.bie.BusinessInfoEntityRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    310,
    'noticecast.logictier.bie.BIETopicImpl',
    'NC_BIETopic',
    'noticecast.datatier.bie.JDBCDhBIETopicImpl',
    'noticecast.logictier.bie.BIETopicRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    320,
    'noticecast.logictier.bie.calculation.CalculationImpl',
    'NC_CALCULATION',
    'noticecast.datatier.bie.calculation.JDBCDhCalculationImpl',
    'noticecast.logictier.bie.calculation.CalculationRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    330,
    'noticecast.logictier.bie.rules.FilterRuleImpl',
    'NC_FILTER_RULE',
    'noticecast.datatier.bie.rules.JDBCDhFilterRuleImpl',
    'noticecast.logictier.bie.rules.FilterRuleRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    340,
    'noticecast.logictier.bie.rules.AggregateRuleImpl',
    'NC_AGGREGATE_RULE',
    'noticecast.datatier.bie.rules.JDBCDhAggregateRuleImpl',
    'noticecast.logictier.bie.rules.AggregateRuleRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    350,
    'noticecast.logictier.bie.rules.ComparativeRuleImpl',
    'NC_COMPARATIVE_RULE',
    'noticecast.datatier.bie.rules.JDBCDhComparativeRuleImpl',
    'noticecast.logictier.bie.rules.ComparativeRuleRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    360,
    NULL,
    'NC_RULE',
    'noticecast.datatier.bie.rules.JDBCDhRuleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    700,
    'noticecast.logictier.recipient.RecipientImpl',
    'NC_RECIPIENT',
    'noticecast.datatier.recipient.JDBCDhRecipientImpl',
    'noticecast.logictier.recipient.RecipientRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    721,
    'noticecast.logictier.message.attachment.MessageAttachment',
    'NC_MESSAGE_ATTACHMENT',
    NULL,
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    740,
    'noticecast.logictier.message.MessageStructImpl',
    'NC_MESSAGESTRUCT',
    'noticecast.datatier.message.JDBCDhJDBCMessageStruct',
    'noticecast.logictier.message.MessageStructRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    741,
    'noticecast.logictier.dynamicrecipient.DynamicRecipientStructImpl',
    'NC_DYNAMIC_RECIPIENT_STRUCT',
    'noticecast.datatier.dynamicrecipient.JDBCDhDynamicRecipientStructImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    742,
    'noticecast.logictier.dynamicrecipient.DynamicDeliveryInformationStructImpl',
    'NC_DYN_DELIVERY_INFO_STRUCT',
    'noticecast.datatier.dynamicrecipient.JDBCDhDynamicDeliveryInfoStructImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    745,
    'noticecast.logictier.recipient.RecipientDeliveryScheduleImpl',
    'NC_RECIPIENTSCHEDULE',
    NULL,
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    746,
    'noticecast.logictier.recipient.DeliveryAddressImpl',
    'NC_DELIVERYADDRESS',
    NULL,
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    900,
    'noticecast.logictier.agent.TaskImpl',
    'NC_TASK',
    'noticecast.datatier.task.JDBCDhJDBCTask',
    'noticecast.logictier.agent.TaskRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    901,
    'noticecast.logictier.agent.TaskImpl',
    'NC_TASK',
    'noticecast.datatier.task.JDBCDhJDBCTask',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    902,
    'noticecast.scheduling.TaskScheduleImpl',
    'NC_TASK_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhTaskScheduleImpl',
    'noticecast.scheduling.TaskScheduleRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    905,
    'noticecast.logictier.agent.TaskImpl',
    'NC_TASK',
    'noticecast.datatier.task.JDBCDhJDBCTask',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    906,
    'noticecast.logictier.agent.TaskImpl',
    'NC_TASK',
    'noticecast.datatier.task.JDBCDhJDBCTask',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    907,
    'noticecast.logictier.agent.TaskImpl',
    'NC_TASK',
    'noticecast.datatier.task.JDBCDhJDBCTask',
    'noticecast.logictier.agent.TaskRImpl'
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    908,
    'noticecast.logictier.agent.TaskImpl',
    'NC_TASK',
    'noticecast.datatier.task.JDBCDhJDBCTask',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    909,
    'noticecast.logictier.executable.ExecutableImpl',
    'NC_EXECUTABLE',
    'noticecast.datatier.executable.JDBCDhJDBCExecuteable',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1000,
    'noticecast.scheduling.YearlySchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1001,
    'noticecast.scheduling.MonthlySchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1002,
    'noticecast.scheduling.WeeklySchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1003,
    'noticecast.scheduling.DailySchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1004,
    'noticecast.scheduling.FixedIntervalSchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1005,
    'noticecast.scheduling.ISchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1020,
    'noticecast.scheduling.ISchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1021,
    'noticecast.scheduling.ISchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1022,
    'noticecast.scheduling.ISchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 INSERT INTO NC_CTMAP (OBJTYPE,CLASS,TABLENAME,HELPER,REMOTECLASS) VALUES(
    1023,
    'noticecast.scheduling.ISchedule',
    'NC_SCHEDULE',
    'noticecast.datatier.scheduling.JDBCDhScheduleImpl',
    NULL
 )
 go
 
 
 INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES(
    1,
    'Create'
 )
 go
 
 INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES(
    2,
    'Read'
 )
 go
 
 INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES(
    3,
    'Update'
 )
 go
 
 INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES(
    4,
    'Delete'
 )
 go
 
 INSERT INTO NC_PERMISSION (PK_PERMISSION_ID,DESCRIPTION) VALUES(
    5,
    'Execute'
 )
 go
  
 INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) VALUES(
    2,
    'build no.'
 )
 go
 
 -------------------------------------------------------------------------------
 --$230-- restore inserts begin
 -------------------------------------------------------------------------------
 
 INSERT INTO NC_AGENT_MESSAGE (LOG_ID,AGENT_ID,MESSAGE,TIMESTAMP) SELECT LOG_ID,AGENT_ID,MESSAGE,TIMESTAMP FROM BC_AGENT_MESSAGE
 go
 
 INSERT INTO NC_AGGREGATE_RULE_TREE (FK_PARENT_ID,FK_CHILD_ID) SELECT FK_PARENT_ID,FK_CHILD_ID FROM BC_AGGREGATE_RULE_TREE
 go
 
 INSERT INTO NC_BIE (PK_BIE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,LASTMOD_BY) SELECT PK_BIE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,LASTMOD_BY FROM BC_BIE
 go
 
 INSERT INTO NC_BIECALC (PK_CALC_ID,LHS_TOPIC_ID,TYPE_NAME,FK_RHSTYPE,OPERATOR,NUMERIC_LITERAL,STRING_LITERAL,DATE_LITERAL,NAME,DESCRIPTION) SELECT PK_CALC_ID,LHS_TOPIC_ID,TYPE_NAME,FK_RHSTYPE,OPERATOR,NUMERIC_LITERAL,STRING_LITERAL,DATE_LITERAL,NAME,DESCRIPTION FROM BC_BIECALC
 go
 
 INSERT INTO NC_BIETOPIC (PK_BIETOPIC_ID,FK_BIE_ID,NAME,DESCRIPTION,FK_DMT_ID,TYPE,MODCOUNT,FK_CALC_ID,FK_BIETOPIC_ID) SELECT PK_BIETOPIC_ID,FK_BIE_ID,NAME,DESCRIPTION,FK_DMT_ID,TYPE,MODCOUNT,FK_CALC_ID,FK_BIETOPIC_ID FROM BC_BIETOPIC
 go
 
 INSERT INTO NC_COGNOS_DS (PK_PP_DS_ID,NAME,DESCRIPTION,SERVER_NAME,SECURITY_DETAILS,PORT_NUMBER) SELECT PK_PP_DS_ID,NAME,DESCRIPTION,SERVER_NAME,SECURITY_DETAILS,PORT_NUMBER FROM BC_COGNOS_DS
 go
 
 INSERT INTO NC_CONFIG_DS (PK_DS_ID,NAME,DESCRIPTION,USERNAME,PASSWORD,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,SERVER_NAME,SECURITY_DETAILS) SELECT PK_DS_ID,NAME,DESCRIPTION,USERNAME,PASSWORD,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,SERVER_NAME,SECURITY_DETAILS FROM BC_CONFIG_DS
 go
 
 INSERT INTO NC_DATAMAPPING (PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL,NIC) SELECT PK_DM_ID,NAME,DESCRIPTION,SQL_STRING,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,FK_PPDS_ID,FK_COGNOSDS_ID,URL,NIC FROM BC_DATAMAPPING
 go
 
 INSERT INTO NC_DB_VERSION (DB_VERSION_ID,BUILD) SELECT DB_VERSION_ID,BUILD FROM BC_DB_VERSION
 go
 
 INSERT INTO NC_DELIVERYADDRESS (PK_DELADDRESS_ID,DELIVERY_ADDRESS,CHANNEL_TYPE,IS_DEFAULT,FK_RECIPIENT_ID) SELECT PK_DELADDRESS_ID,DELIVERY_ADDRESS,CHANNEL_TYPE,IS_DEFAULT,FK_RECIPIENT_ID FROM BC_DELIVERYADDRESS
 go
 
 INSERT INTO NC_DMTOPIC (PK_TOPIC_ID,NAME,DESCRIPTION,TSRC,TLINK,FK_DM_ID,LASTMOD_BY,LASTMOD_TIME,TABLE_NAME,COLUMN_NAME,DRE_COLUMN_NAME,COLUMN_TYPE,PP_TOPIC_VALUE,OBJ_TYPE) SELECT PK_TOPIC_ID,NAME,DESCRIPTION,TSRC,TLINK,FK_DM_ID,LASTMOD_BY,LASTMOD_TIME,TABLE_NAME,COLUMN_NAME,DRE_COLUMN_NAME,COLUMN_TYPE,PP_TOPIC_VALUE,OBJ_TYPE FROM BC_DMTOPIC
 go
 
 INSERT INTO NC_DMT_LINK (PK_DM_ID,FK_DM_ID,FK_DATAMAPPING) SELECT PK_DM_ID,FK_DM_ID,FK_DATAMAPPING FROM BC_DMT_LINK
 go
 
 INSERT INTO NC_DSITEM_L1 (PK_DSITEM1_ID,NAME,DESCRIPTION,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSITEM1_ID,NAME,DESCRIPTION,FK_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM BC_DSITEM_L1
 go
 
 INSERT INTO NC_DSITEM_L2 (PK_DSITEM2_ID,NAME,DESCRIPTION,FK_DSITEM1_ID,TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSITEM2_ID,NAME,DESCRIPTION,FK_DSITEM1_ID,TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM BC_DSITEM_L2
 go
 
 INSERT INTO NC_DSPOOL (PK_DSPOOL_ID,NAME,DESCRIPTION,URL,DRIVER,DS_TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSPOOL_ID,NAME,DESCRIPTION,URL,DRIVER,DS_TYPE,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM BC_DSPOOL
 go
 
 INSERT INTO NC_DYNAMIC_RECIPIENT_STRUCT (PK_ID,NAME,DESCRIPTION,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANYNAME,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,LASTMOD_BY,MODCOUNT) SELECT PK_ID,NAME,DESCRIPTION,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANYNAME,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,LASTMOD_BY,MODCOUNT FROM BC_DYNAMIC_RECIPIENT_STRUCT
 go
 
 INSERT INTO NC_DYN_DELIVERY_INFO_STRUCT (PK_OID,FK_DYNAMIC_RECIPIENT_STRUCT,ADDRESS_DESCRIPTION,CHANNEL_TYPE,ADDRESS_BIE_ID,NAME,LASTMOD_BY,MODCOUNT,DESCRIPTION) SELECT PK_OID,FK_DYNAMIC_RECIPIENT_STRUCT,ADDRESS_DESCRIPTION,CHANNEL_TYPE,ADDRESS_BIE_ID,NAME,LASTMOD_BY,MODCOUNT,DESCRIPTION FROM BC_DYN_DELIVERY_INFO_STRUCT
 go
 
 INSERT INTO NC_EXECUTABLE (PK_EXE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,PATH,FK_TASK_ID) SELECT PK_EXE_ID,NAME,DESCRIPTION,LASTMOD_TIME,MOD_CNT,PATH,FK_TASK_ID FROM BC_EXECUTABLE
 go
 
 INSERT INTO NC_MACHINE_CONFIG (PK_OID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,TIMEZONE) SELECT PK_OID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MOD_CNT,TIMEZONE FROM BC_MACHINE_CONFIG
 go
 
 INSERT INTO NC_MESSAGELINE (FK_MESSAGESTRUCT_ID,LINE_NO,LINE_TYPE) SELECT FK_MESSAGESTRUCT_ID,LINE_NO,LINE_TYPE FROM BC_MESSAGELINE
 go
 
 INSERT INTO NC_MESSAGELINE_ELEMENT (FK_MESSAGESTRUCT_ID,ELEMENT_NUMBER,LINE_NO,TEXT,FK_BIE_TOPIC_ID) SELECT FK_MESSAGESTRUCT_ID,ELEMENT_NUMBER,LINE_NO,TEXT,FK_BIE_TOPIC_ID FROM BC_MESSAGELINE_ELEMENT
 go
 
 INSERT INTO NC_MESSAGESTRUCT (PK_MS_ID,FK_DYNREC_ID,NAME,DESCRIPTION,SOURCE,SUBJECT,MODCOUNT,LASTMOD_BY,CHANNEL_TYPE,CONTACT,AVOID_DUPLICATION) SELECT PK_MS_ID,FK_DYNREC_ID,NAME,DESCRIPTION,SOURCE,SUBJECT,MODCOUNT,LASTMOD_BY,CHANNEL_TYPE,CONTACT,AVOID_DUPLICATION FROM BC_MESSAGESTRUCT
 go
 
 INSERT INTO NC_MESSAGE_ATTACHMENT (PK_ATTACHMENT_ID,FK_MESSAGE_ID,ATTACHMENT_TYPE,ATTACHMENT,ATTACHMENT_SERVER,MIME_TYPE) SELECT PK_ATTACHMENT_ID,FK_MESSAGE_ID,ATTACHMENT_TYPE,ATTACHMENT,ATTACHMENT_SERVER,MIME_TYPE FROM BC_MESSAGE_ATTACHMENT
 go
 
 INSERT INTO NC_MSGDUPLICATION_STORE (MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,DATE_) SELECT MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,DATE_ FROM BC_MSGDUPLICATION_STORE
 go
 
 INSERT INTO NC_MSGDUPLICATION_TEMP_STORE (MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,SESSION_ID) SELECT MSG_PART_ID,TOPIC_STRING_VALUE,FK_BIETOPIC_ID,FK_MESSAGESTRUCT_ID,FK_TASK_ID,SESSION_ID FROM BC_MSGDUPLICATION_TEMP_STORE
 go
 
 INSERT INTO NC_OBJECTCATALOGUE (PK_OID,NAME,DESCRIPTION,SUBTYPE,TYPE,MODCOUNT) SELECT PK_OID,NAME,DESCRIPTION,SUBTYPE,TYPE,MODCOUNT FROM BC_OBJECTCATALOGUE
 go
 
 INSERT INTO NC_OBJECTID (OBJECTID) SELECT OBJECTID FROM BC_OBJECTID
 go
 
 INSERT INTO NC_OBJECT_PERMISSIONS (FK_OID,PERMISSION,ACL) SELECT FK_OID,PERMISSION,ACL FROM BC_OBJECT_PERMISSIONS
 go
 
 INSERT INTO NC_RECIPIENT (PK_RECIPIENT_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANY,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,TO_REDIRECT,FK_REDIRECT_RID,FK_REDIRECT_RGID,IS_EXTERNAL,IS_USEDEFAULTADDRESS) SELECT PK_RECIPIENT_ID,NAME,DESCRIPTION,LASTMOD_BY,LASTMOD_TIME,MODCOUNT,TITLE,FIRSTNAME,MIDDLENAME,LASTNAME,PHONENUMBER,JOBTITLE,COMPANY,DEPARTMENT,OFFICE,COUNTRY,TIMEZONE,TO_REDIRECT,FK_REDIRECT_RID,FK_REDIRECT_RGID,IS_EXTERNAL,IS_USEDEFAULTADDRESS FROM BC_RECIPIENT
 go
 
 INSERT INTO NC_RECIPIENTSCHEDULE (PK_SCHEDULE_ID,SCHEDULE_NAME,FK_RECIPIENT_ID,DELIVERY_SCHEDULE,FK_DELADDRESS_ID) SELECT PK_SCHEDULE_ID,SCHEDULE_NAME,FK_RECIPIENT_ID,DELIVERY_SCHEDULE,FK_DELADDRESS_ID FROM BC_RECIPIENTSCHEDULE
 go
 
 INSERT INTO NC_RULE (PK_RULE_ID,NAME,DESCRIPTION,FK_RULETYPE,FK_RHSTYPE,FK_BIE_ID,LHS_TOPIC_ID,OPERATOR,DATE_LITERAL,STRING_LITERAL,RHS_TOPIC_ID,RHS_OPTION,NUMERIC_LITERAL,RHS_BIE_ID) SELECT PK_RULE_ID,NAME,DESCRIPTION,FK_RULETYPE,FK_RHSTYPE,FK_BIE_ID,LHS_TOPIC_ID,OPERATOR,DATE_LITERAL,STRING_LITERAL,RHS_TOPIC_ID,RHS_OPTION,NUMERIC_LITERAL,RHS_BIE_ID FROM BC_RULE
 go
 
 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_SCHEDULE
 go
 
 INSERT INTO NC_TASK (PK_TASK_ID,NAME,DESCRIPTION,FK_BIE_ID,THRESHOLD,WEIGHTS,TASK_TYPE,DATEFORMAT,DETECTION_OPTION,LASTMOD_TIME,MODCOUNT,LASTMOD_BY) SELECT PK_TASK_ID,NAME,DESCRIPTION,FK_BIE_ID,THRESHOLD,WEIGHTS,TASK_TYPE,DATEFORMAT,DETECTION_OPTION,LASTMOD_TIME,MODCOUNT,LASTMOD_BY FROM BC_TASK
 go
 
 INSERT INTO NC_TASKSCHEDULE (PK_TASKSCHEDULE_ID,FK_TASK_ID,NAME,DESCRIPTION,LASTMOD_BY,MODCOUNT,RUN_REQUIREMENTS,LAST_EXECUTION_AT,NEXT_EXECUTION_REQUEST,SCHEDULE_DELAY) SELECT PK_TASKSCHEDULE_ID,FK_TASK_ID,NAME,DESCRIPTION,LASTMOD_BY,MODCOUNT,RUN_REQUIREMENTS,LAST_EXECUTION_AT,NEXT_EXECUTION_REQUEST,SCHEDULE_DELAY FROM BC_TASKSCHEDULE
 go
 
 INSERT INTO NC_TASK_LOG (LOG_ID,TASK_NAME,TASK_ID,REQUIRED_RUN_TIME,ACTUAL_RUN_TIME,NEXT_RUN_TIME,FINAL_STATE) SELECT LOG_ID,TASK_NAME,TASK_ID,REQUIRED_RUN_TIME,ACTUAL_RUN_TIME,NEXT_RUN_TIME,FINAL_STATE FROM BC_TASK_LOG
 go
 
 INSERT INTO NC_USER_SESSION (TICKET_ID,NC_USER_ID,USER_CLASS) SELECT TICKET_ID,NC_USER_ID,USER_CLASS FROM BC_USER_SESSION
 go
 
 INSERT INTO R_AGENT_ESCALATIONAGENT (FK_CHILD_AGENT_ID,FK_PARENT_AGENT_ID) SELECT FK_CHILD_AGENT_ID,FK_PARENT_AGENT_ID FROM B_AGENT_ESCALATIONAGENT
 go
 
 INSERT INTO R_BIECALC_RHSTOPIC (FK_BIETOPIC_ID,FK_CALC_ID) SELECT FK_BIETOPIC_ID,FK_CALC_ID FROM B_BIECALC_RHSTOPIC
 go
 
 INSERT INTO R_DS_MACHINE_DSPOOL (PK_DSMAC_ID,FK_DSPOOL_ID,FK_MACHINE_ID,FK_CONFIG_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT) SELECT PK_DSMAC_ID,FK_DSPOOL_ID,FK_MACHINE_ID,FK_CONFIG_DS_ID,LASTMOD_BY,LASTMOD_TIME,MOD_CNT FROM B_DS_MACHINE_DSPOOL
 go
 
 INSERT INTO R_MESSAGESTRUCT_TASK (FK_MESSAGESTRUCT_ID,FK_TASK_ID) SELECT FK_MESSAGESTRUCT_ID,FK_TASK_ID FROM B_MESSAGESTRUCT_TASK
 go
 
 INSERT INTO R_MSGSTRUCT_AVOIDTOPICS (FK_MS_ID,FK_BIETOPIC_ID) SELECT FK_MS_ID,FK_BIETOPIC_ID FROM B_MSGSTRUCT_AVOIDTOPICS
 go
 
 INSERT INTO R_MSGSTRUCT_RECIPIENT_DELIVINF (FK_MESSAGESTRUCT_ID,FK_DELIVERY_INFO_ID,FK_RECIPIENT_ID,ADDED_BY_RECIP_ID) SELECT FK_MESSAGESTRUCT_ID,FK_DELIVERY_INFO_ID,FK_RECIPIENT_ID,ADDED_BY_RECIP_ID FROM B_MSGSTRUCT_RECIPIENT_DELIVINF
 go
 
 INSERT INTO R_NEWSITEMS_NCOBJECTS (FK_NCID,NID,VID,TYPE) SELECT FK_NCID,NID,VID,TYPE FROM B_NEWSITEMS_NCOBJECTS
 go
 
 INSERT INTO R_RECIPIENT_ACCMANUSERID (F_RECIPIENTID,ACCMAN_UID) SELECT F_RECIPIENTID,ACCMAN_UID FROM B_RECIPIENT_ACCMANUSERID
 go
 
 INSERT INTO R_RULE_PARAMETER (FK_TASK_ID,LITERAL_TYPE,FK_RULE_ID) SELECT FK_TASK_ID,LITERAL_TYPE,FK_RULE_ID FROM B_RULE_PARAMETER
 go
 
 INSERT INTO R_TASKSCHEDULE_SCHEDULE (FK_TASKSCHEDULE_ID,FK_SCHEDULE_ID,IS_ACTIVE,IS_ESCALATION) SELECT FK_TASKSCHEDULE_ID,FK_SCHEDULE_ID,IS_ACTIVE,IS_ESCALATION FROM B_TASKSCHEDULE_SCHEDULE
 go
 
-------------------------------------------------------------------------------
--$240-- foreign keys add begin
-------------------------------------------------------------------------------

 ALTER TABLE NC_AGGREGATE_RULE_TREE
    ADD CONSTRAINT F2N_AGGREGATE_RULE FOREIGN KEY (FK_CHILD_ID)
       REFERENCES NC_RULE
 go
 
 ALTER TABLE NC_AGGREGATE_RULE_TREE
    ADD CONSTRAINT F1N_AGGREGATE_RULE FOREIGN KEY (FK_PARENT_ID)
       REFERENCES NC_RULE
 go
 
 ALTER TABLE NC_BIETOPIC
    ADD CONSTRAINT F5N_BIETOPIC FOREIGN KEY (FK_DMT_ID)
       REFERENCES NC_DMTOPIC
 go
 
 ALTER TABLE NC_BIETOPIC
    ADD CONSTRAINT F2N_BIETOPIC FOREIGN KEY (FK_BIE_ID)
       REFERENCES NC_BIE
 go
 
 ALTER TABLE NC_DATAMAPPING
    ADD CONSTRAINT F9N_DATAMAPPING FOREIGN KEY (FK_PPDS_ID)
       REFERENCES NC_COGNOS_DS
 go
 
 ALTER TABLE NC_DATAMAPPING
    ADD CONSTRAINT F5N_DATAMAPPING FOREIGN KEY (FK_DS_ID)
       REFERENCES NC_CONFIG_DS
 go
 
 ALTER TABLE NC_DYN_DELIVERY_INFO_STRUCT
    ADD CONSTRAINT F2N_DYN_DELIVERY_I FOREIGN KEY (FK_DYNAMIC_RECIPIENT_STRUCT)
       REFERENCES NC_DYNAMIC_RECIPIENT_STRUCT
 go
 
 ALTER TABLE NC_EXECUTABLE
    ADD CONSTRAINT F7N_EXECUTABLE FOREIGN KEY (FK_TASK_ID)
       REFERENCES NC_TASK
 go
 
 ALTER TABLE NC_MESSAGELINE
    ADD CONSTRAINT F1N_MESSAGELINE FOREIGN KEY (FK_MESSAGESTRUCT_ID)
       REFERENCES NC_MESSAGESTRUCT
 go
 
 ALTER TABLE NC_MESSAGELINE_ELEMENT
    ADD CONSTRAINT F1N_MESSAGELINE_EL FOREIGN KEY (LINE_NO,FK_MESSAGESTRUCT_ID)
       REFERENCES NC_MESSAGELINE
 go
 
 ALTER TABLE NC_MESSAGESTRUCT
    ADD CONSTRAINT F2N_MESSAGESTRUCT FOREIGN KEY (FK_DYNREC_ID)
       REFERENCES NC_DYNAMIC_RECIPIENT_STRUCT
 go
 
 ALTER TABLE NC_MESSAGE_ATTACHMENT
    ADD CONSTRAINT F2N_MESSAGE_ATTACH FOREIGN KEY (FK_MESSAGE_ID)
       REFERENCES NC_MESSAGESTRUCT
 go
 
 ALTER TABLE NC_TASKSCHEDULE
    ADD CONSTRAINT F2N_TASKSCHEDULE FOREIGN KEY (FK_TASK_ID)
       REFERENCES NC_TASK
 go
 
 ALTER TABLE R_AGENT_ESCALATIONAGENT
    ADD CONSTRAINT F2R_AGENT_ESCALATI FOREIGN KEY (FK_PARENT_AGENT_ID)
       REFERENCES NC_TASK
 go
 
 ALTER TABLE R_DS_MACHINE_DSPOOL
    ADD CONSTRAINT F3R_DS_MACHINE_DSP FOREIGN KEY (FK_MACHINE_ID)
       REFERENCES NC_MACHINE_CONFIG
 go
 
 ALTER TABLE R_DS_MACHINE_DSPOOL
    ADD CONSTRAINT F2R_DS_MACHINE_DSP FOREIGN KEY (FK_DSPOOL_ID)
       REFERENCES NC_DSPOOL
 go
 
 ALTER TABLE R_MESSAGESTRUCT_TASK
    ADD CONSTRAINT F2R_MESSAGESTRUCT_ FOREIGN KEY (FK_TASK_ID)
       REFERENCES NC_TASK
 go
 
 ALTER TABLE R_MESSAGESTRUCT_TASK
    ADD CONSTRAINT F1R_MESSAGESTRUCT_ FOREIGN KEY (FK_MESSAGESTRUCT_ID)
       REFERENCES NC_MESSAGESTRUCT
 go
 
 ALTER TABLE R_MSGSTRUCT_AVOIDTOPICS
    ADD CONSTRAINT F1R_MSGSTRUCT_AVOI FOREIGN KEY (FK_MS_ID)
       REFERENCES NC_MESSAGESTRUCT
 go
 
 ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
    ADD CONSTRAINT F3R_MSGSTRUCT_RECI FOREIGN KEY (FK_RECIPIENT_ID)
       REFERENCES NC_RECIPIENT
 go
 
 ALTER TABLE R_MSGSTRUCT_RECIPIENT_DELIVINF
    ADD CONSTRAINT F1R_MSGSTRUCT_RECI FOREIGN KEY (FK_MESSAGESTRUCT_ID)
       REFERENCES NC_MESSAGESTRUCT
 go
 
 ALTER TABLE R_RECIPIENT_ACCMANUSERID
    ADD CONSTRAINT F1R_RECIPIENT_ACCM FOREIGN KEY (F_RECIPIENTID)
       REFERENCES NC_RECIPIENT
 go
 
 ALTER TABLE R_RULE_PARAMETER
    ADD CONSTRAINT F1R_RULE_PARAMETER FOREIGN KEY (FK_TASK_ID)
       REFERENCES NC_TASK
 go
 
 ALTER TABLE R_TASKSCHEDULE_SCHEDULE
    ADD CONSTRAINT F2R_TASKSCHEDULE_S FOREIGN KEY (FK_SCHEDULE_ID)
       REFERENCES NC_SCHEDULE
 go
 
 ALTER TABLE R_TASKSCHEDULE_SCHEDULE
    ADD CONSTRAINT F1R_TASKSCHEDULE_S FOREIGN KEY (FK_TASKSCHEDULE_ID)
       REFERENCES NC_TASKSCHEDULE
 go

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

 DROP TABLE BC_AGENT_MESSAGE
 go
 
 DROP TABLE BC_AGGREGATE_RULE_TREE
 go
 
 DROP TABLE BC_BIE
 go
 
 DROP TABLE BC_BIECALC
 go
 
 DROP TABLE BC_BIETOPIC
 go
 
 DROP TABLE BC_COGNOS_DS
 go
 
 DROP TABLE BC_CONFIG_DS
 go
 
 DROP TABLE BC_CTMAP
 go
 
 DROP TABLE BC_DATAMAPPING
 go
 
 DROP TABLE BC_DB_VERSION
 go
 
 DROP TABLE BC_DELIVERYADDRESS
 go
 
 DROP TABLE BC_DMTOPIC
 go
 
 DROP TABLE BC_DMT_LINK
 go
 
 DROP TABLE BC_DSITEM_L1
 go
 
 DROP TABLE BC_DSITEM_L2
 go
 
 DROP TABLE BC_DSPOOL
 go
 
 DROP TABLE BC_DYNAMIC_RECIPIENT_STRUCT
 go
 
 DROP TABLE BC_DYN_DELIVERY_INFO_STRUCT
 go
 
 DROP TABLE BC_EXECUTABLE
 go
 
 DROP TABLE BC_MACHINE_CONFIG
 go
 
 DROP TABLE BC_MESSAGELINE
 go
 
 DROP TABLE BC_MESSAGELINE_ELEMENT
 go
 
 DROP TABLE BC_MESSAGESTRUCT
 go
 
 DROP TABLE BC_MESSAGE_ATTACHMENT
 go
 
 DROP TABLE BC_MSGDUPLICATION_STORE
 go
 
 DROP TABLE BC_MSGDUPLICATION_TEMP_STORE
 go
 
 DROP TABLE BC_OBJECTCATALOGUE
 go
 
 DROP TABLE BC_OBJECTID
 go
 
 DROP TABLE BC_OBJECT_PERMISSIONS
 go
 
 DROP TABLE BC_PERMISSION
 go
 
 DROP TABLE BC_RECIPIENT
 go
 
 DROP TABLE BC_RECIPIENTSCHEDULE
 go
 
 DROP TABLE BC_RULE
 go
 
 DROP TABLE BC_SCHEDULE
 go
 
 DROP TABLE BC_TASK
 go
 
 DROP TABLE BC_TASKSCHEDULE
 go
 
 DROP TABLE BC_TASK_LOG
 go
 
 DROP TABLE BC_USER_SESSION
 go
 
 DROP TABLE B_AGENT_ESCALATIONAGENT
 go
 
 DROP TABLE B_BIECALC_RHSTOPIC
 go
 
 DROP TABLE B_DS_MACHINE_DSPOOL
 go
 
 DROP TABLE B_MESSAGESTRUCT_TASK
 go
 
 DROP TABLE B_MSGSTRUCT_AVOIDTOPICS
 go
 
 DROP TABLE B_MSGSTRUCT_RECIPIENT_DELIVINF
 go
 
 DROP TABLE B_NEWSITEMS_NCOBJECTS
 go
 
 DROP TABLE B_RECIPIENT_ACCMANUSERID
 go
 
 DROP TABLE B_RULE_PARAMETER
 go
 
 DROP TABLE B_TASKSCHEDULE_SCHEDULE
 go

-------------------------------------------------------------------------------
--	END NC2_UPDATE_SYBASE.SQL       *  DO NOT EDIT  *
-------------------------------------------------------------------------------