IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USERPERMDETAIL' AND KSQL_COL_NAME IN ('FUSERID')) 
 ALTER TABLE T_PERM_USERPERMDETAIL ADD (FUSERID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USERPERMDETAIL' AND KSQL_COL_NAME IN ('FDIMTYPE')) 
 ALTER TABLE T_PERM_USERPERMDETAIL ADD (FDIMTYPE VARCHAR(30) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USERPERMDETAIL' AND KSQL_COL_NAME IN ('FDIMID')) 
 ALTER TABLE T_PERM_USERPERMDETAIL ADD (FDIMID BIGINT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_USERPERMDETAIL' AND KSQL_COL_NAME IN ('FISINCLUDESUB')) 
 ALTER TABLE T_PERM_USERPERMDETAIL ADD (FISINCLUDESUB CHAR(1) DEFAULT '0' NOT NULL );
 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_USERDIM') CREATE INDEX IDX_USERDIM ON T_PERM_USERPERMDETAIL ( FUSERID ,FDIMTYPE ,FDIMID ,FISINCLUDESUB );