@PHOLHAD

DROP TABLE PHWEFD;
@EXECSQL

DROP TABLE PHWENV;
@EXECSQL

CREATE TABLE PHCCNV (
    CODEMP VARCHAR(4) NOT NULL,
    CODCAD VARCHAR(8) NOT NULL,
    SEQUEN VARCHAR(4) NOT NULL,
    ANOMES VARCHAR(8), 
    IDECNV VARCHAR(20),
    DATCNV VARCHAR(10), 
    DATINI VARCHAR(10),
    DATFIN VARCHAR(10),
    DATPAG VARCHAR(10),
    INDLOC VARCHAR(2),
    TIPJOR VARCHAR(2),
    DESCRI VARCHAR(100),
    TOTDIA VARCHAR(4),
    TOTHRS VARCHAR(8),
    CJOR01 VARCHAR(4),
    CJOR02 VARCHAR(4),
    CJOR03 VARCHAR(4),
    CJOR04 VARCHAR(4),
    CJOR05 VARCHAR(4),
    CJOR06 VARCHAR(4),
    CJOR07 VARCHAR(4),
PRIMARY KEY (CODEMP,CODCAD,SEQUEN)
);
@EXECSQL


CREATE TABLE PHCCNV2 (
    CODEMP VARCHAR(4) NOT NULL,
    CODCAD VARCHAR(8) NOT NULL,
    SEQUEN VARCHAR(4) NOT NULL,
    TIPLOG VARCHAR(4),
    DESLOG VARCHAR(15),
    LOGRAD VARCHAR(80),
    NUMERO VARCHAR(10),
    COMPLE VARCHAR(40),
    BAIRRO VARCHAR(40),
    CODMUN VARCHAR(8),
    CIDADE VARCHAR(40),
    ESTADO VARCHAR(2),
    NUMCEP VARCHAR(6),
    CMPCEP VARCHAR(4),
    NUMDDD VARCHAR(4),
    TELEFO VARCHAR(30),
    RESPON VARCHAR(60),
PRIMARY KEY (CODEMP,CODCAD,SEQUEN)
);
@EXECSQL


CREATE TABLE PHMEFF (
    CODEMP VARCHAR(4) NOT NULL,
    CODCAD VARCHAR(8) NOT NULL,
    ANOMES VARCHAR(8) NOT NULL,
    CODFOL VARCHAR(2) NOT NULL,
    TIPREG VARCHAR(4) NOT NULL,
    TIPNIV VARCHAR(2) NOT NULL,
    CODNIV VARCHAR(4) NOT NULL,
    IDE001 VARCHAR(6),
    VLR001 VARCHAR(15),
    IDE002 VARCHAR(6),
    VLR002 VARCHAR(15),
    IDE003 VARCHAR(6),
    VLR003 VARCHAR(15),
    IDE004 VARCHAR(6),
    VLR004 VARCHAR(15),
    IDE005 VARCHAR(6),
    VLR005 VARCHAR(15),
    IDE006 VARCHAR(6),
    VLR006 VARCHAR(15),
    IDE007 VARCHAR(6),
    VLR007 VARCHAR(15),
    IDE008 VARCHAR(6),
    VLR008 VARCHAR(15),
    IDE009 VARCHAR(6),
    VLR009 VARCHAR(15),
    IDE010 VARCHAR(6),
    VLR010 VARCHAR(15),
PRIMARY KEY (CODEMP,CODCAD,ANOMES,CODFOL,TIPREG,TIPNIV,CODNIV)
);
@EXECSQL

CREATE TABLE PHMEFE (
    CODEMP VARCHAR(4) NOT NULL,
    ANOMES VARCHAR(8) NOT NULL,
    CODFOL VARCHAR(2) NOT NULL,
    TIPREG VARCHAR(4) NOT NULL,
    TIPNIV VARCHAR(2) NOT NULL,
    CODNIV VARCHAR(4) NOT NULL,
    IDE001 VARCHAR(6),
    VLR001 VARCHAR(15),
    IDE002 VARCHAR(6),
    VLR002 VARCHAR(15),
    IDE003 VARCHAR(6),
    VLR003 VARCHAR(15),
    IDE004 VARCHAR(6),
    VLR004 VARCHAR(15),
    IDE005 VARCHAR(6),
    VLR005 VARCHAR(15),
    IDE006 VARCHAR(6),
    VLR006 VARCHAR(15),
    IDE007 VARCHAR(6),
    VLR007 VARCHAR(15),
    IDE008 VARCHAR(6),
    VLR008 VARCHAR(15),
    IDE009 VARCHAR(6),
    VLR009 VARCHAR(15),
    IDE010 VARCHAR(6),
    VLR010 VARCHAR(15),
    IDE011 VARCHAR(6),
    VLR011 VARCHAR(15),
    IDE012 VARCHAR(6),
    VLR012 VARCHAR(15),
    IDE013 VARCHAR(6),
    VLR013 VARCHAR(15),
    IDE014 VARCHAR(6),
    VLR014 VARCHAR(15),
    IDE015 VARCHAR(6),
    VLR015 VARCHAR(15),
PRIMARY KEY (CODEMP,ANOMES,CODFOL,TIPREG,TIPNIV,CODNIV)
);
@EXECSQL





