/**Begin D:\PDM_UPGRADE\PDM1\HRCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITSCOPEVIEW') 
 CREATE TABLE T_HRCS_PINITSCOPEVIEW (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEBASE_L') 
 CREATE TABLE T_HRCS_PINITROLEBASE_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEDATA_L') 
 CREATE TABLE T_HRCS_PINITROLEDATA_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITSCOPEEDIT') 
 CREATE TABLE T_HRCS_PINITSCOPEEDIT (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEDIM') 
 CREATE TABLE T_HRCS_PINITROLEDIM (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FBUCAFUNCID BIGINT DEFAULT 0 NOT NULL,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEFUNC_L') 
 CREATE TABLE T_HRCS_PINITROLEFUNC_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEDATAVAL') 
 CREATE TABLE T_HRCS_PINITROLEDATAVAL (
FDETAILID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FSTRUCTPROJECTID BIGINT DEFAULT 0 NOT NULL,
FDIMENSIONID BIGINT DEFAULT 0 NOT NULL,
FDIMVAL VARCHAR(500) DEFAULT ' ' NOT NULL,
FISALL CHAR(1) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEFIELD') 
 CREATE TABLE T_HRCS_PINITROLEFIELD (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FAPPID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTITYTYPEID VARCHAR(36) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FPROPKEY VARCHAR(100) DEFAULT ' ' NOT NULL,
FCANREAD VARCHAR(10) DEFAULT ' ' NOT NULL,
FCANWRITE VARCHAR(10) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEBASE') 
 CREATE TABLE T_HRCS_PINITROLEBASE (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FNAME NVARCHAR(255) DEFAULT ' ' NOT NULL,
FNUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FGROUPID VARCHAR(18) DEFAULT ' ' NOT NULL,
FPROPERTY VARCHAR(10) DEFAULT ' ' NOT NULL,
FISINTERSECTION VARCHAR(10) DEFAULT ' ' NOT NULL,
FCREATEADMINGRP BIGINT DEFAULT 0 NOT NULL,
FUSESCOPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FREMARK NVARCHAR(500) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEDIM_L') 
 CREATE TABLE T_HRCS_PINITROLEDIM_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEFIELD_L') 
 CREATE TABLE T_HRCS_PINITROLEFIELD_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEFUNC') 
 CREATE TABLE T_HRCS_PINITROLEFUNC (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FAPPID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTITYTYPEID VARCHAR(36) DEFAULT ' ' NOT NULL,
FPERMITEMID VARCHAR(18) DEFAULT ' ' NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEDATA') 
 CREATE TABLE T_HRCS_PINITROLEDATA (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(30) DEFAULT ' ' NOT NULL,
FBUCAFUNCID BIGINT DEFAULT 0 NOT NULL,
FERRORMSG NVARCHAR(2000) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_PINITROLEORG') 
 CREATE TABLE T_HRCS_PINITROLEORG (
FPKID BIGINT DEFAULT 0 NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FBASEDATAID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_DIM')
CREATE TABLE T_HRCS_ROLEINITDEMO_DIM (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSCENEID INT DEFAULT 0 NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL
);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_DIME_L')
CREATE TABLE T_HRCS_ROLEINITDEMO_DIME_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_DIM_L')
CREATE TABLE T_HRCS_ROLEINITDEMO_DIM_L (
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_DIMET')
CREATE TABLE T_HRCS_ROLEINITDEMO_DIMET (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FROLENAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FBUCAFUNCNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FADMINORG VARCHAR(50) DEFAULT ' ' NOT NULL,
FSALARYGROUP VARCHAR(50) DEFAULT ' ' NOT NULL,
FSERVICETPL VARCHAR(50) DEFAULT ' ' NOT NULL,
FCOUNTRYAREA VARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_DR')
CREATE TABLE T_HRCS_ROLEINITDEMO_DR (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSCENEID INT DEFAULT 0 NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FBUCAFUNCNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FORGRANGE NVARCHAR(500) DEFAULT ' ' NOT NULL,
FADMINORG NVARCHAR(500) DEFAULT ' ' NOT NULL,
FPROJECTTEAM NVARCHAR(500) DEFAULT ' ' NOT NULL,
FSALARYGROUP NVARCHAR(500) DEFAULT ' ' NOT NULL,
FCOUNTRYAREA NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_DR_L')
CREATE TABLE T_HRCS_ROLEINITDEMO_DR_L (
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FORGRANGE NVARCHAR(500) DEFAULT ' ' NOT NULL,
FADMINORG NVARCHAR(500) DEFAULT ' ' NOT NULL,
FPROJECTTEAM NVARCHAR(500) DEFAULT ' ' NOT NULL,
FSALARYGROUP NVARCHAR(500) DEFAULT ' ' NOT NULL,
FCOUNTRYAREA NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_FC')
CREATE TABLE T_HRCS_ROLEINITDEMO_FC (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSCENEID INT DEFAULT 0 NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_FC_L')
CREATE TABLE T_HRCS_ROLEINITDEMO_FC_L (
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_FCET')
CREATE TABLE T_HRCS_ROLEINITDEMO_FCET (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FCLOUDNUM VARCHAR(50) DEFAULT ' ' NOT NULL,
FCLOUDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPNUM VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNUM NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUCAFUNCNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYROLL_01 VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYROLL_02 VARCHAR(50) DEFAULT ' ' NOT NULL,
FPAYROLL_03 VARCHAR(50) DEFAULT ' ' NOT NULL,
FCH_020 VARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_FCET_L')
CREATE TABLE T_HRCS_ROLEINITDEMO_FCET_L (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FCLOUDNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUCAFUNCNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FDIMNAME NVARCHAR(200) DEFAULT ' ' NOT NULL,
FNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNUM NVARCHAR(50) DEFAULT ' ' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_FP')
CREATE TABLE T_HRCS_ROLEINITDEMO_FP (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSCENEID INT DEFAULT 0 NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAPPNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FAPPNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPROPKEY VARCHAR(100) DEFAULT ' ' NOT NULL,
FPROPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCANREAD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCANWRITE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_FP_L')
CREATE TABLE T_HRCS_ROLEINITDEMO_FP_L (
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FAPPNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FENTITYNAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FPROPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FCANREAD NVARCHAR(50) DEFAULT ' ' NOT NULL,
FCANWRITE NVARCHAR(50) DEFAULT ' ' NOT NULL
);


IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_ROLE')
CREATE TABLE T_HRCS_ROLEINITDEMO_ROLE (
FID BIGINT DEFAULT 0 NOT NULL,
FCREATORID BIGINT DEFAULT 0 NOT NULL,
FCREATETIME DATETIME,
FMODIFIERID BIGINT DEFAULT 0 NOT NULL,
FMODIFYTIME DATETIME,
FSCENEID INT DEFAULT 0 NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FINDEX INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FROLEGROUPNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FROLEGROUPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FROLEPROPERTY VARCHAR(10) DEFAULT ' ' NOT NULL,
FROLECBISINTERSECTION VARCHAR(10) DEFAULT ' ' NOT NULL,
FADMINGROUPNUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FADMINGROUPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FUSESCOPE VARCHAR(10) DEFAULT ' ' NOT NULL,
FPUBLICSCOPEVIEW NVARCHAR(100) DEFAULT ' ' NOT NULL,
FPUBLICSCOPEEDIT NVARCHAR(100) DEFAULT ' ' NOT NULL,
FROLEREMARK NVARCHAR(50) DEFAULT ' ' NOT NULL
);



IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_ROLE_L')
CREATE TABLE T_HRCS_ROLEINITDEMO_ROLE_L (
FID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FSCENENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FSCENEDESC NVARCHAR(500) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FROLEGROUPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL,
FROLEREMARK NVARCHAR(50) DEFAULT ' ' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_PINITROLEBASE' AND KSQL_COL_NAME IN ('FROLETYPE'))
ALTER TABLE T_HRCS_PINITROLEBASE ADD (FROLETYPE VARCHAR(20) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_DR' AND KSQL_COL_NAME IN ('FSERVICETPL'))
ALTER TABLE T_HRCS_ROLEINITDEMO_DR ADD (FSERVICETPL VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_ROLE' AND KSQL_COL_NAME IN ('FROLETYPE'))
ALTER TABLE T_HRCS_ROLEINITDEMO_ROLE ADD (FROLETYPE VARCHAR(20) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_ROLEINITDEMO_DIME')
CREATE TABLE T_HRCS_ROLEINITDEMO_DIME (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FROLENUMBER VARCHAR(50) DEFAULT ' ' NOT NULL,
FROLENAME NVARCHAR(50) DEFAULT ' ' NOT NULL,
FBUCAFUNCNAME VARCHAR(50) DEFAULT ' ' NOT NULL,
FADMINORG VARCHAR(50) DEFAULT ' ' NOT NULL,
FSALARYGROUP VARCHAR(50) DEFAULT ' ' NOT NULL,
FSERVICETPL VARCHAR(50) DEFAULT ' ' NOT NULL,
FCOUNTRYAREA VARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_FCET' AND KSQL_COL_NAME IN ('FPAYROLL_ONE'))
ALTER TABLE T_HRCS_ROLEINITDEMO_FCET ADD (FPAYROLL_ONE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_FCET' AND KSQL_COL_NAME IN ('FPAYROLL_TWO'))
ALTER TABLE T_HRCS_ROLEINITDEMO_FCET ADD (FPAYROLL_TWO VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_FCET' AND KSQL_COL_NAME IN ('FPAYROLL_THREE'))
ALTER TABLE T_HRCS_ROLEINITDEMO_FCET ADD (FPAYROLL_THREE VARCHAR(50) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_FCET' AND KSQL_COL_NAME IN ('FCH_TWO'))
ALTER TABLE T_HRCS_ROLEINITDEMO_FCET ADD (FCH_TWO VARCHAR(50) DEFAULT ' ' NOT NULL );

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_DR_L' AND KSQL_COL_NAME IN ('FSERVICETPL'))
ALTER TABLE T_HRCS_ROLEINITDEMO_DR_L ADD (FSERVICETPL NVARCHAR(50) DEFAULT ' ' NOT NULL );
EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_DR', 'FSERVICETPL', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';

IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_ROLE_L' AND KSQL_COL_NAME IN ('FADMINGROUPNAME'))
ALTER TABLE T_HRCS_ROLEINITDEMO_ROLE_L ADD (FADMINGROUPNAME NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_ROLE_L' AND KSQL_COL_NAME IN ('FPUBLICSCOPEVIEW'))
ALTER TABLE T_HRCS_ROLEINITDEMO_ROLE_L ADD (FPUBLICSCOPEVIEW NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_ROLEINITDEMO_ROLE_L' AND KSQL_COL_NAME IN ('FPUBLICSCOPEEDIT'))
ALTER TABLE T_HRCS_ROLEINITDEMO_ROLE_L ADD (FPUBLICSCOPEEDIT NVARCHAR(100) DEFAULT ' ' NOT NULL );

/**
EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_ROLE', 'FADMINGROUPNAME', 'NVARCHAR(100)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_ROLE', 'FPUBLICSCOPEVIEW', 'NVARCHAR(100)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_ROLE', 'FPUBLICSCOPEEDIT', 'NVARCHAR(100)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_DIME', 'FROLENAME', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_FCET', 'FCLOUDNAME', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_FCET', 'FAPPNAME', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_FCET', 'FENTITYNAME', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_FCET', 'FBUCAFUNCNAME', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_FCET', 'FDIMNAME', 'NVARCHAR(200)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_FCET', 'FNAME', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';

EXEC p_AlterColumn 'T_HRCS_ROLEINITDEMO_FCET', 'FENTITYNUM', 'NVARCHAR(50)', 'NOT NULL', '1111', ''' ''';
*/
