-- 日志打印标识
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SPLITEDROWDATA') 
 CREATE TABLE T_EB_SPLITEDROWDATA (
FID BIGINT DEFAULT 0 NOT NULL,
FSPLITBILLID BIGINT DEFAULT 0 NOT NULL,
FTEMPLATEID BIGINT DEFAULT 0 NOT NULL,
FSPLITROWID BIGINT DEFAULT 0 NOT NULL,
FSPLITDIMPART  NVARCHAR(2000) NOT NULL DEFAULT ' '
);
EXEC P_ALTERPK 'pk_T_EB_SPLITEDROWDATA', 'T_EB_SPLITEDROWDATA', 'FID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SPLITEDROWDATA')
CREATE INDEX IDX_EB_SPLITEDROWDATA ON T_EB_SPLITEDROWDATA (
FSPLITBILLID ASC,
FTEMPLATEID ASC
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SPLITEDDIMROWDATA') 
 CREATE TABLE T_EB_SPLITEDDIMROWDATA (
FID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSPLITDIMCOL  NVARCHAR(30) NOT NULL DEFAULT ' ',
FMODIFIEDROWS  NCLOB
);
EXEC P_ALTERPK 'pk_t_eb_spliteddimrowdata', 'T_EB_SPLITEDDIMROWDATA', 'FENTRYID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SPLITEDDIMROWDATA')
CREATE INDEX IDX_EB_SPLITEDDIMROWDATA ON T_EB_SPLITEDDIMROWDATA (
FID ASC
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_SPLITMODIFYLOG') 
 CREATE TABLE T_EB_SPLITMODIFYLOG (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATOR BIGINT DEFAULT 0 NOT NULL,
FMODELID BIGINT DEFAULT 0 NOT NULL,
FCREATEDATE	DATETIME,
FBILLNUMBER  NVARCHAR(100) NOT NULL DEFAULT ' ',
FTEMPNUMBER  NVARCHAR(100) NOT NULL DEFAULT ' ',
FMODIFYROWID	BIGINT DEFAULT 0 NOT NULL,
FLOGTEXT NVARCHAR(2000) NOT NULL DEFAULT ' '
);
EXEC P_ALTERPK 'pk_t_eb_splitmodifylog', 'T_EB_SPLITMODIFYLOG', 'FID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_SPLITMODIFYLOG')
CREATE INDEX IDX_EB_SPLITMODIFYLOG ON T_EB_SPLITMODIFYLOG (
FMODELID ASC,
FTEMPNUMBER ASC
);

