/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SYS_table.sql **/

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_OPEN_APIQUERYFILTER') 
 CREATE TABLE T_OPEN_APIQUERYFILTER (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFILTERLEFTBRACKET VARCHAR(5) DEFAULT ' ' NOT NULL,
FFILTERCOLUMN VARCHAR(50) DEFAULT ' ' NOT NULL,
FFILTERLABEL VARCHAR(50) DEFAULT ' ' NOT NULL,
FFILTERCOMPARE VARCHAR(25) DEFAULT ' ' NOT NULL,
FFILTERVALUE VARCHAR(50)  DEFAULT ' ' NOT NULL,
FFILTERRIGHTBRACKET VARCHAR(5) DEFAULT ' ' NOT NULL,
FFILTERLINK VARCHAR(5) DEFAULT ' ' NOT NULL
);




IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_OPEN_APISERVICE' AND KSQL_COL_NAME='FISKSQL') 
 ALTER TABLE T_OPEN_APISERVICE ADD (FISKSQL CHAR(1) DEFAULT '0'  NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_OPEN_APISERVICE' AND KSQL_COL_NAME='FSELECTPARAM') 
 ALTER TABLE T_OPEN_APISERVICE ADD (FSELECTPARAM VARCHAR(2000) );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_OPEN_APISERVICE' AND KSQL_COL_NAME='FFILTERPARAM') 
 ALTER TABLE T_OPEN_APISERVICE ADD (FFILTERPARAM VARCHAR(2000) );

 IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_OPEN_APISERVICE' AND KSQL_COL_NAME='FMUSTPARAM') 
 ALTER TABLE T_OPEN_APISERVICE ADD (FMUSTPARAM VARCHAR(2000) );
 


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