
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISSCHEME_L') 
 DROP TABLE T_BCM_ISSCHEME_L;
 
IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISBASEENTLIST_L') 
 DROP TABLE T_BCM_ISBASEENTLIST_L;
 
  
 IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDIMMAP_L') 
 DROP TABLE T_BCM_ISDIMMAP_L;

 IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDIMMAPSRCDEFVAL_L') 
 DROP TABLE T_BCM_ISDIMMAPSRCDEFVAL_L;
 
 IF EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDIMMAPTARGDEFVAL_L') 
 DROP TABLE T_BCM_ISDIMMAPTARGDEFVAL_L;
 
 
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISBASEENTLIST_L') 
 CREATE TABLE T_BCM_ISBASEENTLIST_L (
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(30) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(36) DEFAULT ' ' NOT NULL
);


 EXEC P_ALTERPK 'PK_T_BCM_ISBASEENTLIST_L', 'T_BCM_ISBASEENTLIST_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'T_BCM_ISBASEENTLIST_L_FID') CREATE INDEX T_BCM_ISBASEENTLIST_L_FID ON T_BCM_ISBASEENTLIST_L ( FID );
 
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISSCHEME_L') 
 CREATE TABLE T_BCM_ISSCHEME_L (
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(30) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(36) DEFAULT ' ' NOT NULL
);


 EXEC P_ALTERPK 'PK_T_BCM_ISSCHEME_L', 'T_BCM_ISSCHEME_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'T_BCM_ISSCHEME_L_FID') CREATE INDEX T_BCM_ISSCHEME_L_FID ON T_BCM_ISSCHEME_L ( FID );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDIMMAP_L') 
 CREATE TABLE T_BCM_ISDIMMAP_L (
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(30) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(36) DEFAULT ' ' NOT NULL
);

 EXEC P_ALTERPK 'PK_T_BCM_ISDIMMAP_L', 'T_BCM_ISDIMMAP_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'T_BCM_ISDIMMAP_L_FID') CREATE INDEX T_BCM_ISDIMMAP_L_FID ON T_BCM_ISDIMMAP_L ( FID );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDIMMAPSRCDEFVAL_L') 
 CREATE TABLE T_BCM_ISDIMMAPSRCDEFVAL_L (
FSRCMEMNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(30) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(36) DEFAULT ' ' NOT NULL
);

 EXEC P_ALTERPK 'PK_T_BCM_ISDIMMAPSRCDEFVAL_L', 'T_BCM_ISDIMMAPSRCDEFVAL_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'T_BCM_ISDIMMAPSRCDEFVAL_L_FID') CREATE INDEX T_BCM_ISDIMMAPSRCDEFVAL_L_FID ON T_BCM_ISDIMMAPSRCDEFVAL_L ( FID );
 
 IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_BCM_ISDIMMAPTARGDEFVAL_L') 
 CREATE TABLE T_BCM_ISDIMMAPTARGDEFVAL_L (
FTAGMEMNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FPKID VARCHAR(30) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(36) DEFAULT ' ' NOT NULL
);

 EXEC P_ALTERPK 'PK_T_BCM_ISDIMMAPTARGDEFVAL_L', 'T_BCM_ISDIMMAPTARGDEFVAL_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'T_BCM_ISDIMMAPTARGDEFVAL_L_FID') CREATE INDEX T_BCM_ISDIMMAPTARGDEFVAL_L_FID ON T_BCM_ISDIMMAPTARGDEFVAL_L ( FID );