/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCTB_table.sql **/
/**IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_DECLARE_MAIN_ATT') 
 CREATE TABLE T_TCTB_DECLARE_MAIN_ATT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_DECLARE_MAIN' AND KSQL_COL_NAME ='FARCHIVESTATUS') 
 ALTER TABLE T_TCTB_DECLARE_MAIN ADD (FARCHIVESTATUS VARCHAR(50) DEFAULT 'unfiled' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_DECLARE_MAIN' AND KSQL_COL_NAME ='FARCHIVETIME') 
 ALTER TABLE T_TCTB_DECLARE_MAIN ADD (FARCHIVETIME DATETIME );**/
 EXEC p_AlterColumn 'T_TCTB_TAXPARAM', 'FAVALIBLEVAL', 'VARCHAR(200)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_TAXPARAM' AND KSQL_COL_NAME ='FISMULTIPLE') 
 ALTER TABLE T_TCTB_TAXPARAM ADD (FISMULTIPLE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_TCTB_TAXPARAM' AND KSQL_COL_NAME ='FMULVALUE') 
 ALTER TABLE T_TCTB_TAXPARAM ADD (FMULVALUE VARCHAR(50) DEFAULT ' ' NOT NULL );

/**End E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCTB_table.sql **/
