-- 库存请检单
-- 增加核心单相关字段
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY_R' AND KSQL_COL_NAME ='FMAINBILLNUMBER')
 ALTER TABLE T_IM_INVINSPECTBILLENTRY_R ADD (FMAINBILLNUMBER NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY_R' AND KSQL_COL_NAME ='FMAINBILLENTRYSEQ')
 ALTER TABLE T_IM_INVINSPECTBILLENTRY_R ADD (FMAINBILLENTRYSEQ BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY_R' AND KSQL_COL_NAME ='FMAINBILLENTITY')
 ALTER TABLE T_IM_INVINSPECTBILLENTRY_R ADD (FMAINBILLENTITY NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY_R' AND KSQL_COL_NAME ='FMAINBILLID')
 ALTER TABLE T_IM_INVINSPECTBILLENTRY_R ADD (FMAINBILLID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_IM_INVINSPECTBILLENTRY_R' AND KSQL_COL_NAME ='FMAINBILLENTRYID')
 ALTER TABLE T_IM_INVINSPECTBILLENTRY_R ADD (FMAINBILLENTRYID BIGINT DEFAULT 0 NOT NULL );
