Hello everyone! I've spent the whole morning trying to figure this out, so im asking you for help: The following code works and creates both tables WORK.VENDAS_INDV_MES and DB2VNOT.VENDAS_INDV_MES: PROC SQL;
CREATE TABLE WORK.VENDAS_INDV_MES AS
SELECT DISTINCT t1.AAAAMM,
t1.NR_UNCO_CTR_OPR,
t1.NR_CTR_OPR,
t1.CD_CLI,
t1.CD_CPNT_RSTD,
t1.CD_PRF_RSTD,
t1.DT_APRC,
t1.MES,
t1.ANO,
t1.CD_DIRETORIA,
t1.NM_DIRETORIA,
t1.SUPER,
t1.NM_SUPER,
t1.CD_GEREV,
t1.NM_GEREV,
t1.PREFIXO_FUNCI,
t1.NM_PREFIXO_FUNCI,
t1.CD_PRF_CTRA_CLI,
t1.CD_TIP_CTRA_CLI,
t1.MAT_FUNCI,
t1.NM_FUNCI,
t1.FUNCAO,
t1.SEXO,
t1.CD_ITCE_CNL_ATDT,
t1.CD_PRD,
t1.CD_MDLD,
t1.NM_MDLD,
t1.VL_CPNT_RSTD,
t1.VL_ULT_SDO,
t1.COMPONENTE
FROM WORK.INCLUI_NM_MDLD t1
WHERE t1.AAAAMM = &AnoMes;
QUIT;
proc sql;
drop table DB2VNOT.VENDAS_INDV_MES;
quit;
PROC SQL;
CREATE TABLE DB2VNOT.VENDAS_INDV_MES AS
SELECT DISTINCT /*t1.AAAAMM,*/
t1.NR_UNCO_CTR_OPR,
/*t1.NR_CTR_OPR,*/
/*t1.CD_CLI,*/
t1.CD_CPNT_RSTD,
/*t1.CD_PRF_RSTD,*/
t1.DT_APRC,
t1.MES,
t1.ANO,
t1.CD_DIRETORIA,
t1.NM_DIRETORIA,
t1.SUPER,
t1.NM_SUPER,
t1.CD_GEREV,
t1.NM_GEREV,
t1.PREFIXO_FUNCI,
t1.NM_PREFIXO_FUNCI,
/*t1.CD_PRF_CTRA_CLI,*/
t1.CD_TIP_CTRA_CLI,
t1.NM_FUNCI,
t1.FUNCAO,
t1.SEXO,
t1.CD_ITCE_CNL_ATDT,
t1.NM_MDLD,
t1.VL_CPNT_RSTD,
t1.VL_ULT_SDO,
t1.COMPONENTE
FROM WORK.VENDAS_INDV_MES t1;
QUIT; But, if i uncomment any of the commented columns above i get this error on DB2VNOT.VENDAS_INDV_MES : ERROR: Error attempting to CREATE a DBMS table. ERROR: CLI execute error: [IBM][CLI Driver][DB2] SQL0104N An unexpected token "("
was found following "". Expected tokens may include: ", ) UNIQUE REFERENCES PRIMARY CONSTRAINT INLINE IMPLICITLY".
SQLSTATE=42601 . I've also tried: data DB2VNOT.VENDAS_INDV_MES;
set WORK.VENDAS_INDV_MES;
run; An got the same error. None of those columns is suposed to have a UNIQUE Constraint
... View more