/**Begin D:\PDM_UPGRADE\PDM1\kd_1.5.252_soehrr_table_240609.sql.sql **/
 EXEC p_AlterColumn 'T_SOEHRR_RPTTPLENTRY', 'FSAMPLEJSON', 'VARCHAR(255)', 'NOT NULL', '0011', ''' ''';

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


IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SOEHRR_FILLTASK' AND KSQL_COL_NAME ='FMSGCONTENT') 
 ALTER TABLE T_SOEHRR_FILLTASK ADD (FMSGCONTENT VARCHAR(255) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_SOEHRR_FILLTASK' AND KSQL_COL_NAME ='FMSGCONTENT_TAG') 
 ALTER TABLE T_SOEHRR_FILLTASK ADD (FMSGCONTENT_TAG NCLOB );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SOEHRR_SUMREPORT_L') 
 CREATE TABLE T_SOEHRR_SUMREPORT_L (
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FIMPORTREPORTDATA NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SOEHRR_SUMREPORGS') 
 CREATE TABLE T_SOEHRR_SUMREPORGS (
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_SOEHRR_SUMFILLREPORT') 
 CREATE TABLE T_SOEHRR_SUMFILLREPORT (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFILLTASK VARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_SOEHRR_SUMREPORT') 
 CREATE TABLE T_SOEHRR_SUMREPORT (
FID BIGINT DEFAULT 0 NOT NULL,
FNUMBER VARCHAR(60) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FSTATUS VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FENABLE VARCHAR(2) DEFAULT ' ' NOT NULL,
FCREATETIME DATETIME,
FMODIFYTIME DATETIME,
FMASTERID BIGINT DEFAULT 0 NOT NULL,
FSIMPLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION NVARCHAR(255) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FISSYSPRESET CHAR(1) DEFAULT '0' NOT NULL,
FDISABLERID BIGINT DEFAULT 0 NOT NULL,
FDISABLEDATE DATETIME,
FRECORDJSON VARCHAR(255) DEFAULT ' ' NOT NULL,
FRECORDJSON_TAG NCLOB,
FTREPCONTENT VARCHAR(255) DEFAULT ' ' NOT NULL,
FTREPCONTENT_TAG NCLOB,
FCOLLECTTASK BIGINT DEFAULT 0 NOT NULL,
FIMPORTREPORTDATA NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FSHEETCOMBO VARCHAR(60) DEFAULT ' ' NOT NULL
);



/**End D:\PDM_UPGRADE\PDM1\kd_1.5.252_soehrr_table_240609.sql.sql **/
