/**BEGIN**/

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RULEBATCH')
 CREATE TABLE T_EB_RULEBATCH (
FID BIGINT DEFAULT 0 NOT NULL,
FMODEL BIGINT DEFAULT 0 NOT NULL,
FBIZCTRLRANGE BIGINT DEFAULT 0 NOT NULL,
FDATASET BIGINT DEFAULT 0 NOT NULL,
FNUMBER NVARCHAR(150) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FRULETEMPLATE NCLOB,
FCREATER BIGINT DEFAULT 0 NOT NULL,
FMODIFIER BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE DATETIME,
FMODIFYDATE DATETIME
);
-- 主键
EXEC P_ALTERPK 'PK_T_EB_RULEBATCH', 'T_EB_RULEBATCH', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_RULEBATCH_FMODEL')
CREATE INDEX IDX_EB_RULEBATCH_FMODEL ON T_EB_RULEBATCH ( FMODEL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_RULEBATCHRELATION')
 CREATE TABLE T_EB_RULEBATCHRELATION (
FID BIGINT DEFAULT 0 NOT NULL,
FRULEBATCH BIGINT DEFAULT 0 NOT NULL,
FRULE BIGINT DEFAULT 0 NOT NULL,
FSCOPE NCLOB
);
-- 主键
EXEC P_ALTERPK 'PK_T_EB_RULEBATCHRELATION', 'T_EB_RULEBATCHRELATION', 'FID', '1';
-- 索引
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_RULEBATCHRELATION_FRULEBATCH')
CREATE INDEX IDX_EB_RULEBATCHRELATION_FRULEBATCH ON T_EB_RULEBATCHRELATION ( FRULEBATCH );

/**END**/