
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_REQUIRETYPE' AND KSQL_COL_NAME ='FPROJECTREQ')
      ALTER TABLE T_BD_REQUIRETYPE ADD (FPROJECTREQ CHAR(1) DEFAULT '0' NOT NULL);
	  
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_REQUIRETYPE' AND KSQL_COL_NAME ='FISCURRENTSTOCK')
      ALTER TABLE T_BD_REQUIRETYPE ADD (FISCURRENTSTOCK CHAR(1) DEFAULT '0' NOT NULL);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_REQUIRETYPE' AND KSQL_COL_NAME ='FISINWAY')
      ALTER TABLE T_BD_REQUIRETYPE ADD (FISINWAY CHAR(1) DEFAULT '0' NOT NULL);
	  
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_REQUIRETYPE' AND KSQL_COL_NAME ='FDEMANDREDUCE')
      ALTER TABLE T_BD_REQUIRETYPE ADD (FDEMANDREDUCE CHAR(1) DEFAULT '0' NOT NULL);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BD_MANUSTRCONFIGENTRY' AND KSQL_COL_NAME ='FALONEDEMANDTYPE')
      ALTER TABLE T_BD_MANUSTRCONFIGENTRY ADD (FALONEDEMANDTYPE VARCHAR(30) DEFAULT ' ' NOT NULL);
	  
	  
	  
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_REQUIRETYPE_NO_INV') 
 CREATE TABLE T_BD_REQUIRETYPE_NO_INV (
FBASEDATAID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPKID BIGINT DEFAULT 0 NOT NULL
);

 EXEC P_ALTERPK 'PK_BD_REQUIRETYPE_NO_INV', 'T_BD_REQUIRETYPE_NO_INV', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_BD_REQUIRETYPE_NO_INV_ID') CREATE INDEX IDX_BD_REQUIRETYPE_NO_INV_ID ON T_BD_REQUIRETYPE_NO_INV ( FID );