IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PERM_ADMINSCHEME' AND KSQL_COL_NAME ='FISALLOWBIZOPERATE') 
 ALTER TABLE T_PERM_ADMINSCHEME ADD (FISALLOWBIZOPERATE CHAR(1) DEFAULT '0' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PERM_USERADMINTAG') 
 CREATE TABLE T_PERM_USERADMINTAG (
FID BIGINT DEFAULT 0 NOT NULL,
FUSERID BIGINT DEFAULT 0 NOT NULL,
FTRANSFERORID BIGINT DEFAULT 0 NOT NULL,
FTRANSFERTIME DATETIME,
FADMINTAG CHAR(2) DEFAULT ' ' NOT NULL
);

EXEC P_ALTERPK 'PK_T_PERM_USERADMINTAG', 'T_PERM_USERADMINTAG', 'FID', '1';

IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PERM_USERADMINTAG') CREATE INDEX IDX_PERM_USERADMINTAG ON T_PERM_USERADMINTAG ( FADMINTAG );