/**Begin C:\PDM_UPGRADE\PDM1\SRC_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_APPLYENTRY' AND KSQL_COL_NAME IN ('FBDPROJECTID')) 
 ALTER TABLE T_SRC_APPLYENTRY ADD (FBDPROJECTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLIST' AND KSQL_COL_NAME IN ('FBIZSCHEMEID')) 
 ALTER TABLE T_SRC_PURLIST ADD (FBIZSCHEMEID BIGINT DEFAULT 0 NOT NULL );
 EXEC p_AlterColumn 'T_SRC_PURLIST_ITEM', 'FREQUEST', 'NVARCHAR(510)', 'NOT NULL', '0100', ''' ''';

 EXEC p_AlterColumn 'T_SRC_PURLIST_ITEM', 'FREPLY', 'NVARCHAR(510)', 'NOT NULL', '0100', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLIST_ITEM' AND KSQL_COL_NAME IN ('FBIZITEMLD')) 
 ALTER TABLE T_SRC_PURLIST_ITEM ADD (FBIZITEMLD BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLIST_ITEM' AND KSQL_COL_NAME IN ('FREPLYVALUE')) 
 ALTER TABLE T_SRC_PURLIST_ITEM ADD (FREPLYVALUE NVARCHAR(510) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_NOTYEARINFO' AND KSQL_COL_NAME IN ('FBDPROJECTID')) 
 ALTER TABLE T_SRC_NOTYEARINFO ADD (FBDPROJECTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME IN ('FADDTIMENUM')) 
 ALTER TABLE T_SRC_PROJECT_O ADD (FADDTIMENUM INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PROJECT_O' AND KSQL_COL_NAME IN ('FADDTIMECOUNT')) 
 ALTER TABLE T_SRC_PROJECT_O ADD (FADDTIMECOUNT INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_PURLISTENTRY_F' AND KSQL_COL_NAME IN ('FBDPROJECTID')) 
 ALTER TABLE T_SRC_PURLISTENTRY_F ADD (FBDPROJECTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_CONTRACTENTRY_A' AND KSQL_COL_NAME IN ('FBDPROJECTID')) 
 ALTER TABLE T_SRC_CONTRACTENTRY_A ADD (FBDPROJECTID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_CONTRACTENTRY_A' AND KSQL_COL_NAME IN ('FCUSTOMERID')) 
 ALTER TABLE T_SRC_CONTRACTENTRY_A ADD (FCUSTOMERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SRC_CONTRACTENTRY_A' AND KSQL_COL_NAME IN ('FSALORGID')) 
 ALTER TABLE T_SRC_CONTRACTENTRY_A ADD (FSALORGID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_BIZITEM') 
 CREATE TABLE T_SRC_BIZITEM (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FPARAMTYPE CHAR(1) DEFAULT '1' NOT NULL,
FBIZOBJECT BIGINT DEFAULT 0 NOT NULL,
FFIELDNAME CHAR(1) DEFAULT '1' NOT NULL,
FREMARK NVARCHAR(600) 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
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_BIZSCHEME') 
 CREATE TABLE T_SRC_BIZSCHEME (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(600) DEFAULT ' ' NOT NULL,
FPLUGIN VARCHAR(100) 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,
FMATCHFIELD INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SRC_BIZSCHEMESRCTYPE') 
 CREATE TABLE T_SRC_BIZSCHEMESRCTYPE (
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_BIZSCHEMESRCFLOW') 
 CREATE TABLE T_SRC_BIZSCHEMESRCFLOW (
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_BIZITEM_L') 
 CREATE TABLE T_SRC_BIZITEM_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_BIZSCHEME_L') 
 CREATE TABLE T_SRC_BIZSCHEME_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_BIZSCHEMEENTRY') 
 CREATE TABLE T_SRC_BIZSCHEMEENTRY (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FBIZITEMLD BIGINT DEFAULT 0 NOT NULL,
FREQUEST NVARCHAR(600) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(600) DEFAULT ' ' NOT NULL
);



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