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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PUR_REGSUPPLYSCOPE') 
 CREATE TABLE T_PUR_REGSUPPLYSCOPE (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FENTRYREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FLONGNUMBER VARCHAR(1500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_REGSUPPLIER_PROV' AND KSQL_COL_NAME ='FENTRYID') 
 ALTER TABLE T_PUR_REGSUPPLIER_PROV ADD (FENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PUR_IMPROVE' AND KSQL_COL_NAME ='FCONFIRMSTATUS') 
 ALTER TABLE T_PUR_IMPROVE ADD (FCONFIRMSTATUS CHAR(1) DEFAULT ' ' NOT NULL );

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