/**BEGIN  **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATADELETE')
CREATE TABLE T_EB_DATADELETE
(
	FID            BIGINT           DEFAULT 0   NOT NULL,
	FMODEL         BIGINT           DEFAULT 0   NOT NULL,
    FBUSMODEL      BIGINT           DEFAULT 0   NOT NULL,
    FDATASET       BIGINT           DEFAULT 0   NOT NULL,
    FNAME          NVARCHAR(50)     DEFAULT ' ' NOT NULL,
	FREASION       NVARCHAR(255)    DEFAULT ' ' NOT NULL,
    FCOMMENTS      NVARCHAR(255)    DEFAULT ' ' NOT NULL,
    FCOUNT         BIGINT           DEFAULT 0   NOT NULL,
    FREAD          CHAR(1)          DEFAULT ' ' NOT NULL,
	FCUBEBACKUP    CHAR(1)          DEFAULT ' ' NOT NULL,
	FAPPROVESTATUS CHAR(1)          DEFAULT ' ' NOT NULL,
    FDELETESTATUS  CHAR(1)          DEFAULT ' ' NOT NULL,
    FERRORINFO     NCLOB            DEFAULT ' ' NOT NULL,
    FBACKUPPATH    NVARCHAR(255)    DEFAULT ' ' NOT NULL,
	FMODIFIER      BIGINT           DEFAULT 0   NOT NULL,
    FAPPROVER      BIGINT           DEFAULT 0   NOT NULL,
    FCREATER       BIGINT           DEFAULT 0   NOT NULL,
    FSUBMITTER     BIGINT           DEFAULT 0   NOT NULL,
    FCREATEDATE    DATETIME,
    FMODIFYDATE    DATETIME,
	FDELETEDATE    DATETIME,
	FAPPROVEDATE   DATETIME
);
EXEC P_ALTERPK 'PK_T_EB_DATADELETE', 'T_EB_DATADELETE', 'FID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DATADELETE')
CREATE INDEX IDX_EB_DATADELETE ON T_EB_DATADELETE (FMODEL ASC);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_EB_DATADELETE_DIMS')
CREATE TABLE T_EB_DATADELETE_DIMS
(
	FID          BIGINT        DEFAULT 0   NOT NULL,
	FENTRYID     BIGINT        DEFAULT 0   NOT NULL,
	FSEQ         INT           DEFAULT 0   NOT NULL,
    FDIMID       BIGINT        DEFAULT 0   NOT NULL,
    FDIMNAME     NVARCHAR(50)  DEFAULT ' ' NOT NULL,
    FDIMNUMBER   NVARCHAR(50)  DEFAULT ' ' NOT NULL,
    FMEMBERS     NCLOB         DEFAULT ' ' NOT NULL,
    FMEMBERSCOPE NCLOB         DEFAULT ' ' NOT NULL,
    FMEMBERSJSON NCLOB         DEFAULT ' ' NOT NULL 
);
EXEC P_ALTERPK 'PK_T_EB_DATADELETE_DIMS', 'T_EB_DATADELETE_DIMS', 'FENTRYID', '1';
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_EB_DATADELETE_DIMS')
CREATE INDEX IDX_EB_DATADELETE_DIMS ON T_EB_DATADELETE_DIMS (FID ASC);
/**END **/

    