IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_WBS')
 CREATE TABLE T_BD_WBS (
FID                             BIGINT              DEFAULT         0          NOT NULL,
FNUMBER                         NVARCHAR(30)        DEFAULT       ' '          NOT NULL,
FNAME                           NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FSTATUS                         NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FCREATORID                      BIGINT              DEFAULT         0          NOT NULL,
FMODIFIERID                     BIGINT              DEFAULT         0          NOT NULL,
FENABLE                         NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FCREATETIME                     DATETIME,
FMODIFYTIME                     DATETIME,
FMASTERID                       BIGINT              DEFAULT         0          NOT NULL,
FLONGNUMBER                     NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FLEVEL                          INT                 DEFAULT         0          NOT NULL,
FISLEAF                         CHAR(1)             DEFAULT       '1'          NOT NULL,
FPARENTID                       BIGINT              DEFAULT         0          NOT NULL,
FCREATEORGID                    BIGINT              DEFAULT         0          NOT NULL,
FORGID                          BIGINT              DEFAULT         0          NOT NULL,
FCTRLSTRATEGY                   NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FSOURCEDATAID                   BIGINT              DEFAULT         0          NOT NULL,
FBITINDEX                       INT                 DEFAULT         0          NOT NULL,
FSOURCEBITINDEX                 INT                 DEFAULT         0          NOT NULL,
FPROJECTID                      BIGINT              DEFAULT         0          NOT NULL,
FISPLAN                         CHAR(1)             DEFAULT       '0'          NOT NULL,
FISCHECK                        CHAR(1)             DEFAULT       '0'          NOT NULL,
FISINVOICE                      CHAR(1)             DEFAULT       '0'          NOT NULL,
FNOTE                           NVARCHAR(255)       DEFAULT       ' '          NOT NULL,
FBUSINESSSTATE                  NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FDATASOURCE                     NVARCHAR(50)        DEFAULT       ' '          NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_WBS_L')
 CREATE TABLE T_BD_WBS_L (
FPKID                           NVARCHAR(36)        DEFAULT       ' '          NOT NULL,
FID                             BIGINT              DEFAULT         0          NOT NULL,
FLOCALEID                       NVARCHAR(10)        DEFAULT       ' '          NOT NULL,
FNAME                           NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FFULLNAME                       NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FNOTE                           NVARCHAR(255)       DEFAULT       ' '          NOT NULL
);




IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BD_PROJECTPARAM')
 CREATE TABLE T_BD_PROJECTPARAM (
FID                             BIGINT              DEFAULT         0          NOT NULL,
FNUMBER                         NVARCHAR(30)        DEFAULT       ' '          NOT NULL,
FNAME                           NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FSTATUS                         NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FCREATORID                      BIGINT              DEFAULT         0          NOT NULL,
FMODIFIERID                     BIGINT              DEFAULT         0          NOT NULL,
FENABLE                         NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FCREATETIME                     DATETIME,
FMODIFYTIME                     DATETIME,
FMASTERID                       BIGINT              DEFAULT         0          NOT NULL,
FCREATEORGID                    BIGINT              DEFAULT         0          NOT NULL,
FORGID                          BIGINT              DEFAULT         0          NOT NULL,
FCTRLSTRATEGY                   NVARCHAR(50)        DEFAULT       ' '          NOT NULL,
FSOURCEDATAID                   BIGINT              DEFAULT         0          NOT NULL,
FBITINDEX                       INT                 DEFAULT         0          NOT NULL,
FSOURCEBITINDEX                 INT                 DEFAULT         0          NOT NULL,
FPROJECTKINDID                  BIGINT              DEFAULT         0          NOT NULL,
FISPLAN                         CHAR(1)             DEFAULT       '0'          NOT NULL,
FISCHECK                        CHAR(1)             DEFAULT       '0'          NOT NULL,
FISINVOICE                      CHAR(1)             DEFAULT       '0'          NOT NULL,
FDESC                           NVARCHAR(255)       DEFAULT       ' '          NOT NULL
);


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