IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TSRBD_CFGMSGCHANNEL')
 CREATE TABLE T_TSRBD_CFGMSGCHANNEL (
FID BIGINT DEFAULT 0 NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FCHANNELID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TSRBD_CFGMSGENTRY')
 CREATE TABLE T_TSRBD_CFGMSGENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCHANNELID BIGINT DEFAULT 0 NOT NULL,
FCATEGORY NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSMSTEMPCONTEXT NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FEMAILTITLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEMAILTEMPCONTEXT NCLOB DEFAULT ' ',
FEMAILTEMPCONTEXT_TAG NCLOB
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_TSRBD_MSGINST')
 CREATE TABLE T_TSRBD_MSGINST (
FID BIGINT DEFAULT 0 NOT NULL,
FBILLID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FMSGCHANNELLIST VARCHAR(255) DEFAULT ' ' NOT NULL,
FRECEIVERTYPE VARCHAR(4) DEFAULT ' ' NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCHANNELID BIGINT DEFAULT 0 NOT NULL,
FCATEGORY VARCHAR(50) DEFAULT ' ' NOT NULL,
FSMSTEMPCONTEXT NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FEMAILTITLE NVARCHAR(50) DEFAULT ' ' NOT NULL,
FEMAILTEMPCONTEXT NCLOB DEFAULT ' ',
FEMAILTEMPCONTEXT_TAG NCLOB,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FSENDTIME DATETIME
);



