/**Begin D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FACREG') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FACREG BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FBILLQTY') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FBILLQTY DECIMAL(23,10) DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FATANUMBER') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FATANUMBER NVARCHAR(80) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FATACHAPTERNO') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FATACHAPTERNO BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FORDERID') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FORDERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FSUPPLYRESP') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FSUPPLYRESP VARCHAR(5) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FCONMTYPENAME') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FCONMTYPENAME NVARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FCONMTYPENUMBER') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FCONMTYPENUMBER NVARCHAR(2000) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_MDS_SAMPLEHISRECORD' AND KSQL_COL_NAME ='FCONMTYPEID') 
 ALTER TABLE T_MDS_SAMPLEHISRECORD ADD (FCONMTYPEID NVARCHAR(2000) DEFAULT ' ' NOT NULL );

/**End D:\k3Cloud\PDM_UPGRADE\PDM1\MDS_table.sql **/
