IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_HRCS_CALSERVICEREGISTER_L') 
 CREATE TABLE T_HRCS_CALSERVICEREGISTER_L (
FPKID BIGINT DEFAULT 0 NOT NULL,
FNAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FSIMPLENAME VARCHAR(100) DEFAULT ' ' NOT NULL,
FDESCRIPTION VARCHAR(255) DEFAULT ' ' NOT NULL,
FLOCALEID VARCHAR(50) DEFAULT ' ' NOT NULL,
FID BIGINT DEFAULT 0 NOT NULL
);

 EXEC p_AlterColumn 'T_HRCS_CALSERVICEREGISTER_L', 'FPKID', 'VARCHAR(50)', 'NOT NULL', '1111', ''' ''';

 EXEC p_AlterColumn 'T_HRCS_CALSERVICEREGISTER_L', 'FLOCALEID', 'VARCHAR(10)', 'NOT NULL', '0100', ''' ''';


 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_CALSERVICEREGISTER') CREATE INDEX IDX_HRCS_CALSERVICEREGISTER ON T_HRCS_CALSERVICEREGISTER ( FNUMBER );

 EXEC P_ALTERPK 'PK_HRCS_CALSERVICEREGISTER_L', 'T_HRCS_CALSERVICEREGISTER_L', 'FPKID', '1';

 IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_HRCS_CALSERVICEREGISTER_L') CREATE INDEX IDX_HRCS_CALSERVICEREGISTER_L ON T_HRCS_CALSERVICEREGISTER_L ( FLOCALEID ,FID );