/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\BEI_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FFLOWSERIALNO') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FFLOWSERIALNO NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FSORTID') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FSORTID NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FTRANSDATE') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FTRANSDATE DATETIME );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FREQUESTSERIALNO') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FREQUESTSERIALNO NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FRESPONSESERAILNO') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FRESPONSESERAILNO NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FKDRETFLAG') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FKDRETFLAG NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FAGENTACCNO') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FAGENTACCNO NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FAGENTACCNAME') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FAGENTACCNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FAGENTACCBANKNAME') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FAGENTACCBANKNAME NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FBUSTYPE') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FBUSTYPE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FBATCHNO') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FBATCHNO NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FBILLNOBILLNO') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FBILLNOBILLNO NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_BEI_TRANSDETAIL_E' AND KSQL_COL_NAME ='FEXTDATA') 
 ALTER TABLE T_BEI_TRANSDETAIL_E ADD (FEXTDATA NVARCHAR(255) DEFAULT ' ' NOT NULL );

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