/**Begin C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT' AND KSQL_COL_NAME IN ('FPLANSCHEMEID')) 
 ALTER TABLE T_SRC_PROJECT ADD (FPLANSCHEMEID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_QUESTION' AND KSQL_COL_NAME IN ('FISCLARIFY')) 
 ALTER TABLE T_SRC_QUESTION ADD (FISCLARIFY CHAR(1) DEFAULT '0' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_INVITESUPPLIER' AND KSQL_COL_NAME IN ('FASSESSORDER')) 
 ALTER TABLE T_SRC_INVITESUPPLIER ADD (FASSESSORDER INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PATTERN' AND KSQL_COL_NAME IN ('FPRIORITY')) 
 ALTER TABLE T_SRC_PATTERN ADD (FPRIORITY INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SCHEME' AND KSQL_COL_NAME IN ('FPRIORITY')) 
 ALTER TABLE T_SRC_SCHEME ADD (FPRIORITY INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_SUPSCHEME' AND KSQL_COL_NAME IN ('FPRIORITY')) 
 ALTER TABLE T_SRC_SUPSCHEME ADD (FPRIORITY INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_EXPERTSCHEME' AND KSQL_COL_NAME IN ('FPRIORITY')) 
 ALTER TABLE T_SRC_EXPERTSCHEME ADD (FPRIORITY INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_OPENSCHEME' AND KSQL_COL_NAME IN ('FPRIORITY')) 
 ALTER TABLE T_SRC_OPENSCHEME ADD (FPRIORITY INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_BIZSCHEME' AND KSQL_COL_NAME IN ('FPRIORITY')) 
 ALTER TABLE T_SRC_BIZSCHEME ADD (FPRIORITY INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_NEGSCHEME' AND KSQL_COL_NAME IN ('FPRIORITY')) 
 ALTER TABLE T_SRC_NEGSCHEME ADD (FPRIORITY INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PLANITEM') 
 CREATE TABLE T_SRC_PLANITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FBIZNODEID BIGINT DEFAULT 0 NOT NULL,
FBIZURGEID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISV_ID VARCHAR(50) DEFAULT ' ' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PLANITEM_L') 
 CREATE TABLE T_SRC_PLANITEM_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PLANSCHEME') 
 CREATE TABLE T_SRC_PLANSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FMATCHFIELD INT DEFAULT 0 NOT NULL,
FPRIORITY INT DEFAULT 0 NOT NULL,
FSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FENABLE CHAR(1) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FISV_ID VARCHAR(50) DEFAULT ' ' NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PLANSCHEME_L') 
 CREATE TABLE T_SRC_PLANSCHEME_L (
FPKID VARCHAR(36) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PLANSCHEMEENTRY') 
 CREATE TABLE T_SRC_PLANSCHEMEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FPLANITEMID BIGINT DEFAULT 0 NOT NULL,
FHOURS DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PLANSCHEME_TYPE') 
 CREATE TABLE T_SRC_PLANSCHEME_TYPE (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PLANSCHEME_FLOW') 
 CREATE TABLE T_SRC_PLANSCHEME_FLOW (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SOURCEPLAN') 
 CREATE TABLE T_SRC_SOURCEPLAN (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FPLANITEMID BIGINT DEFAULT 0 NOT NULL,
FBEGINDATE DATETIME,
FENDDATE DATETIME,
FHOURS DECIMAL(19,6) DEFAULT 0 NOT NULL,
FREMARK NVARCHAR(255) DEFAULT ' ' NOT NULL,
FBEGINDATE2 DATETIME,
FENDDATE2 DATETIME,
FHOURS2 DECIMAL(19,6) DEFAULT 0 NOT NULL,
FTIMEDIFF DECIMAL(19,6) DEFAULT 0 NOT NULL,
FPLANDIFF DECIMAL(19,6) DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_PRICECLARIFY') 
 CREATE TABLE T_SRC_PRICECLARIFY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ BIGINT DEFAULT 0 NOT NULL,
FTURNS VARCHAR(2) DEFAULT ' ' NOT NULL,
FISNEW CHAR(1) DEFAULT '0' NOT NULL,
FPACKAGENAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FMATERIALID BIGINT DEFAULT 0 NOT NULL,
FMATERIALNANE NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCATEGORYID BIGINT DEFAULT 0 NOT NULL,
FMATERIALMODEL NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNT DECIMAL(23,10) DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FENTRYSTATUS CHAR(1) DEFAULT ' ' NOT NULL,
FSRCENTRYID VARCHAR(50) DEFAULT ' ' NOT NULL,
FPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FPRICENEW DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXPRICENEW DECIMAL(23,10) DEFAULT 0 NOT NULL,
FAMOUNTNEW DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXAMOUNTNEW DECIMAL(23,10) DEFAULT 0 NOT NULL,
FCURRENCYID BIGINT DEFAULT 0 NOT NULL,
FCURRENCYIDNEW BIGINT DEFAULT 0 NOT NULL,
FQTY DECIMAL(23,10) DEFAULT 0 NOT NULL,
FQTYNEW DECIMAL(23,10) DEFAULT 0 NOT NULL,
FUNITID BIGINT DEFAULT 0 NOT NULL,
FTAXITEMID BIGINT DEFAULT 0 NOT NULL,
FTAXITEMIDNEW BIGINT DEFAULT 0 NOT NULL,
FTAXRATE DECIMAL(23,10) DEFAULT 0 NOT NULL,
FTAXRATENEW DECIMAL(23,10) DEFAULT 0 NOT NULL,
FISPRESENT CHAR(1) DEFAULT '0' NOT NULL,
FISPRESENTNEW CHAR(1) DEFAULT '0' NOT NULL,
FISDISCARDED CHAR(1) DEFAULT '0' NOT NULL,
FISDISCARDEDNEW CHAR(1) DEFAULT '0' NOT NULL,
FNOTE NVARCHAR(512) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_SCENE_SUPPLIER2') 
 CREATE TABLE T_SRC_SCENE_SUPPLIER2 (
FPKID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);



/**End C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
