/**Begin D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_table.sql **/
 EXEC p_AlterColumn 'T_BCM_INVRELATION', 'FINVRELATYPE', 'VARCHAR(30)', 'NOT NULL', '1111', '''1''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_INVSHEETENTRY' AND KSQL_COL_NAME ='FRELATIONTYPEID') 
 ALTER TABLE T_BCM_INVSHEETENTRY ADD (FRELATIONTYPEID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_BCM_EXTENDDATA_INV', 'FRELATIONTYPE', 'VARCHAR(30)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BCM_EXTENDDATA_INV' AND KSQL_COL_NAME ='FCATEGORIZED') 
 ALTER TABLE T_BCM_EXTENDDATA_INV ADD (FCATEGORIZED CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVRELATYPE') 
 CREATE TABLE T_BCM_INVRELATYPE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT '0' NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FCREATERID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FCATEGORIZED CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_INVRELATYPE_L') 
 CREATE TABLE T_BCM_INVRELATYPE_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_PAPERTEMPLATE_RLT') 
 CREATE TABLE T_BCM_PAPERTEMPLATE_RLT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);



/**End D:\DBA\1.4\PDM_UPGRADE\PDM1\BCM_table.sql **/
