/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\TCTB_table.sql **/
/** kd_1.5.9_tctb_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TEMPLATE_TYPE') 
 CREATE TABLE T_TCTB_TEMPLATE_TYPE (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FMAINTABLE VARCHAR(100) DEFAULT ' ' NOT NULL,
FUNIQUETYPE VARCHAR(100) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TEMPLATE_TYPE_DET') 
 CREATE TABLE T_TCTB_TEMPLATE_TYPE_DET (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FENTITYID VARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITYNAME VARCHAR(100) DEFAULT ' ' NOT NULL
);
/** kd_1.5.9.2_tctb_table.sql 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TEMPLATE_TYPE') 
 CREATE TABLE T_TCTB_TEMPLATE_TYPE (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FMAINTABLE VARCHAR(100) DEFAULT ' ' NOT NULL,
FUNIQUETYPE VARCHAR(100) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TCTB_TEMPLATE_TYPE_DET') 
 CREATE TABLE T_TCTB_TEMPLATE_TYPE_DET (
FID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FENTITYID VARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITYNAME VARCHAR(100) DEFAULT ' ' NOT NULL
);**/

 /** kd_1.5.85_tctb_table.sql **/
 EXEC p_AlterColumn 'T_TCTB_TEMPLATE_TYPE_DET', 'FID', 'VARCHAR(36)', 'NOT NULL', '0100', ''' ''';
/** kd_1.5.86_tctb_table_3.sql **/
 EXEC p_AlterColumn 'T_TCTB_TEMPLATE_TYPE', 'FID', 'VARCHAR(36)', 'NOT NULL', '0100', ''' ''';


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