IF NOT EXISTS (SELECT 1 FROM KSQL_USERCOLUMNS WHERE KSQL_COL_TABNAME = 'T_PMTS_TASK' AND KSQL_COL_NAME ='FSYSACTUALPER')
 ALTER TABLE T_PMTS_TASK ADD (FSYSACTUALPER DECIMAL(23,10) DEFAULT 0 NOT NULL );
 
IF NOT EXISTS (SELECT 1 FROM KSQL_USERTABLES WHERE KSQL_TABNAME = 'T_PMTS_TASK_WORKSHIFTS') 
CREATE TABLE T_PMTS_TASK_WORKSHIFTS
(
  FPKID             BIGINT       DEFAULT 0         NOT NULL,          	
  FID               BIGINT       DEFAULT 0         NOT NULL,        
  FBASEDATAID       BIGINT       DEFAULT 0         NOT NULL
);


EXEC P_ALTERPK 'PK_PMTS_TASK_WORKSHIFTS', 'T_PMTS_TASK_WORKSHIFTS', 'FPKID', '1';
 
IF NOT EXISTS (SELECT 1 FROM KSQL_INDEXES WHERE KSQL_INDNAME = 'IDX_PMTS_TASK_WORKSHIFTS') CREATE INDEX IDX_PMTS_TASK_WORKSHIFTS ON T_PMTS_TASK_WORKSHIFTS ( FID ,FBASEDATAID );


 
