/**Begin E:\NextERP_PDM\PDM_UPGRADE\PDMS\branch_lastest\pdm\SRC_table.sql **/
 EXEC p_AlterColumn 'T_SRC_VIE_DETAIL', 'FQUOTEAMT', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_SRC_VIE_DETAIL', 'FREDUCEAMT', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_SRC_VIE_DETAIL', 'FEXCHANGE', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_SRC_VIE_DETAIL', 'FLOCQUOTEAMT', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

 EXEC p_AlterColumn 'T_SRC_VIE_DETAIL', 'FLOCREDUCEAMT', 'DECIMAL(23,10)', 'NOT NULL', '0100', '0';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FSRCENTRYID') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FSRCENTRYID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FPRICE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FAMOUNT') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FTAXITEMID') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FTAXITEMID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FTAXRATE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FTAX') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FTAX DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FTAXPRICE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FTAXAMOUNT') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FEXCHTYPEID') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FEXCHTYPEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FLOCCURRID') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FLOCCURRID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FLOCPRICE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FLOCPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FLOCTAXPRICE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FLOCTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FLOCAMOUNT') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FLOCAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FLOCTAXAMOUNT') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FLOCTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FTURNS') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FTURNS CHAR(2) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FVIETURNS') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FVIETURNS CHAR(2) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FSUPPLIERIP') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FSUPPLIERIP NVARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FBIDCOUNT') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FBIDCOUNT INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FNOTE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FNOTE NVARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FRANK') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FRANK INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FMAXPRICE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FMAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FMAXTAXPRICE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FMAXTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_DETAIL' AND KSQL_COL_NAME ='FEXCHRATE') 
 ALTER TABLE T_SRC_VIE_DETAIL ADD (FEXCHRATE DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_VIE_TURNS' AND KSQL_COL_NAME ='FVIETURNS') 
 ALTER TABLE T_SRC_VIE_TURNS ADD (FVIETURNS CHAR(2) DEFAULT ' ' NOT NULL );

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