/**Begin D:\pdm\PDM_UPGRADE\PDM1\HRCS_table.sql **/
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY' AND KSQL_COL_NAME ='FFIELDID') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY ADD (FFIELDID INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY' AND KSQL_COL_NAME ='FFIELDNUMBER') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY ADD (FFIELDNUMBER VARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY' AND KSQL_COL_NAME ='FFIELDNAME') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY ADD (FFIELDNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY' AND KSQL_COL_NAME ='FENTITYNAMEALIAS') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY ADD (FENTITYNAMEALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY' AND KSQL_COL_NAME ='FENTITYNUMBER') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY ADD (FENTITYNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY' AND KSQL_COL_NAME ='FENTITYNUMBERALIAS') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY ADD (FENTITYNUMBERALIAS VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY' AND KSQL_COL_NAME ='FDISPLAYNAME') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY ADD (FDISPLAYNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
 
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY_L' AND KSQL_COL_NAME ='FFIELDNAME') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY_L ADD (FFIELDNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY_L' AND KSQL_COL_NAME ='FENTITYNAMEALIAS') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY_L ADD (FENTITYNAMEALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONDENTRY_L' AND KSQL_COL_NAME ='FDISPLAYNAME') 
 ALTER TABLE T_HRCS_LBLOBJCONDENTRY_L ADD (FDISPLAYNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONFIG' AND KSQL_COL_NAME ='FRULELABEL') 
 ALTER TABLE T_HRCS_LBLOBJCONFIG ADD (FRULELABEL CHAR(1) DEFAULT '1' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJCONFIG' AND KSQL_COL_NAME ='FMANUALLABEL') 
 ALTER TABLE T_HRCS_LBLOBJCONFIG ADD (FMANUALLABEL CHAR(1) DEFAULT '0' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY' AND KSQL_COL_NAME ='FFIELDID') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY ADD (FFIELDID INT DEFAULT 0 NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY' AND KSQL_COL_NAME ='FFIELDNUMBER') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY ADD (FFIELDNUMBER VARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY' AND KSQL_COL_NAME ='FFIELDNAME') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY ADD (FFIELDNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY' AND KSQL_COL_NAME ='FENTITYNAMEALIAS') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY ADD (FENTITYNAMEALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY' AND KSQL_COL_NAME ='FENTITYNUMBERALIAS') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY ADD (FENTITYNUMBERALIAS VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY' AND KSQL_COL_NAME ='FENTITYNUMBER') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY ADD (FENTITYNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY' AND KSQL_COL_NAME ='FDISPLAYNAME') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY ADD (FDISPLAYNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY_L' AND KSQL_COL_NAME ='FFIELDNAME') 

 ALTER TABLE T_HRCS_LBLOBJDISPENTRY_L ADD (FFIELDNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY_L' AND KSQL_COL_NAME ='FENTITYNAMEALIAS') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY_L ADD (FENTITYNAMEALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJDISPENTRY_L' AND KSQL_COL_NAME ='FDISPLAYNAME') 
 ALTER TABLE T_HRCS_LBLOBJDISPENTRY_L ADD (FDISPLAYNAME NVARCHAR(300) DEFAULT ' ' NOT NULL );
IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_HRCS_LBLOBJECTFIELD' AND KSQL_COL_NAME ='FSELECTEDFIELD') 
 ALTER TABLE T_HRCS_LBLOBJECTFIELD ADD (FSELECTEDFIELD CHAR(1) DEFAULT '1' NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_LBLOBJMNLENTRY') 
 CREATE TABLE T_HRCS_LBLOBJMNLENTRY (
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL,
FSEQ INT DEFAULT 0 NOT NULL,
FFIELDID INT DEFAULT 0 NOT NULL,
FFIELDNUMBER VARCHAR(300) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FENTITYNAMEALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITYNUMBER VARCHAR(100) DEFAULT ' ' NOT NULL,
FENTITYNUMBERALIAS VARCHAR(100) DEFAULT ' ' NOT NULL,
FDISPLAYNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FSEARCHFIELD CHAR(1) DEFAULT '0' NOT NULL
);

IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_LBLOBJMNLENTRY_L') 
 CREATE TABLE T_HRCS_LBLOBJMNLENTRY_L (
FPKID VARCHAR(18) DEFAULT ' ' NOT NULL,
FENTRYID BIGINT DEFAULT 0 NOT NULL,
FLOCALEID VARCHAR(10) DEFAULT ' ' NOT NULL,
FFIELDNAME NVARCHAR(300) DEFAULT ' ' NOT NULL,
FENTITYNAMEALIAS NVARCHAR(100) DEFAULT ' ' NOT NULL,
FDISPLAYNAME NVARCHAR(300) DEFAULT ' ' NOT NULL
);
/**End D:\pdm\PDM_UPGRADE\PDM1\HRCS_table.sql **/
