/**Begin D:\PDM_UPGRADE\PDM1\HBSS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_LAWENTITY') 
 CREATE TABLE T_HBSS_LAWENTITY (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FLAWENTITY VARCHAR(2) DEFAULT ' ' NOT NULL,
FENTITYTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FCORPARATEORGID BIGINT DEFAULT 0 NOT NULL,
FOPRSTS VARCHAR(2) DEFAULT '1' NOT NULL,
FPROPCTL VARCHAR(100) DEFAULT ' ' NOT NULL,
FENTERPRISE CHAR(1) DEFAULT '0' NOT NULL,
FSIGNCOMPANY CHAR(1) DEFAULT '0' NOT NULL,
FTAXUNIT CHAR(1) DEFAULT '0' NOT NULL,
FWELFAREPAYER CHAR(1) DEFAULT '0' NOT NULL,
FPAYSUBJECT CHAR(1) DEFAULT '0' NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FUNIFORMSOCIALCREDITCODE VARCHAR(100) DEFAULT ' ' NOT NULL,
FFIRMNAME VARCHAR(255) DEFAULT ' ' NOT NULL,
FREPRESENTATIVE VARCHAR(255) DEFAULT ' ' NOT NULL,
FESTABLISHMENTDATE DATETIME,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FPHONE VARCHAR(100) DEFAULT ' ' NOT NULL,
FADDRESS VARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_LAWENTITY_L') 
 CREATE TABLE T_HBSS_LAWENTITY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_LAWENTITYVRINF') 
 CREATE TABLE T_HBSS_LAWENTITYVRINF (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FLAWENTITY VARCHAR(2) DEFAULT ' ' NOT NULL,
FENTITYTYPE VARCHAR(2) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FOPRSTS VARCHAR(2) DEFAULT '1' NOT NULL,
FPROPCTL VARCHAR(100) DEFAULT ' ' NOT NULL,
FENTERPRISE CHAR(1) DEFAULT '0' NOT NULL,
FSIGNCOMPANY CHAR(1) DEFAULT '0' NOT NULL,
FTAXUNITLBL CHAR(1) DEFAULT '0' NOT NULL,
FWELFAREPAYER CHAR(1) DEFAULT '0' NOT NULL,
FPAYSUBJECT CHAR(1) DEFAULT '0' NOT NULL,
FADMINORGID BIGINT DEFAULT 0 NOT NULL,
FUNIFORMSOCIALCREDITCODE VARCHAR(100) DEFAULT ' ' NOT NULL,
FFIRMNAME VARCHAR(255) DEFAULT ' ' NOT NULL,
FREPRESENTATIVE VARCHAR(255) DEFAULT ' ' NOT NULL,
FESTABLISHMENTDATE DATETIME,
FSTARTDATE DATETIME,
FENDDATE DATETIME,
FPHONE VARCHAR(100) DEFAULT ' ' NOT NULL,
FADDRESS VARCHAR(255) DEFAULT ' ' NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FVERNUM VARCHAR(60) DEFAULT ' ' NOT NULL,
FCHGEFFECTDATE DATETIME,
FCHGTYPE VARCHAR(100) DEFAULT ' ' NOT NULL,
FCHGDESC VARCHAR(100) DEFAULT ' ' NOT NULL,
FCHGCREATORID BIGINT DEFAULT 0 NOT NULL,
FCHGCREATETIME DATETIME
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_LAWENTITYVRINF_L') 
 CREATE TABLE T_HBSS_LAWENTITYVRINF_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_LAWENTITYUSE') 
 CREATE TABLE T_HBSS_LAWENTITYUSE (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FENABLE VARCHAR(2) DEFAULT '1' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT 'C' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FRELLAWENTITYID BIGINT DEFAULT 0 NOT NULL,
FOPITEMID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HBSS_LAWENTITYUSE_L') 
 CREATE TABLE T_HBSS_LAWENTITYUSE_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\HBSS_table.sql **/
