Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Boa tarde Senhores (as).
Gostaria de fazer uma carga incremental a partir de um campo datatime para não precisar carregar toda a informação toda hora.
exemplo script :
set Variavel_hora = MAX(data_acionamento) ;
conexão banco de dados ;
SQL select * from acionamentos where data_acionamento > "variavel_hora (datetime)"
Store informacao nova into caminho QVD.
Obrigado.
Paulo, segue um exemplo de uma tabela do SAP que ao inves de um campo data tem um campo sequencial.
Seria adaptar as suas necessidades.
/===================================================================================================================
// incremental
//
//=================================================================================================================================
TRACE '$(STGPath)\$(STGPrefixo)CDPOS.QVD';
//
LET vQvdExists = if(FileSize('$(Path)\CDPOS.QVD') > 0, -1, 0);
IF $(vQvdExists) THEN
MaxSeq:
LOAD MaxString(CHANGENR) as MaxSeq FROM [$(Path)\CDPOS.QVD] (qvd);
LET vIncrementalExpression = ' and CHANGENR >=' & chr(39) & peek('MaxSeq') & chr(39);
DROP table MaxSeq;
ELSE
LET vIncrementalExpression = '';
END IF
TRACE '$(vIncrementalExpression)';
//=================================================================================================================================
CDPOS:
SQL SELECT * FROM CDPOS Where TABNAME = 'MARA' and FNAME = 'MSTAE' and OBJECTCLAS = 'MATERIAL' $(vIncrementalExpression);
//
IF $(vQvdExists) THEN
CONCATENATE (CDPOS) LOAD * FROM $(Path)\CDPOS.QVD (qvd) WHERE NOT exists(CHANGENR);
END IF
//
STORE CDPOS INTO $(Path)\CDPOS.QVD(QVD);
DROP TABLE CDPOS;
//=================================================================================================================================
Paulo, segue um exemplo de uma tabela do SAP que ao inves de um campo data tem um campo sequencial.
Seria adaptar as suas necessidades.
/===================================================================================================================
// incremental
//
//=================================================================================================================================
TRACE '$(STGPath)\$(STGPrefixo)CDPOS.QVD';
//
LET vQvdExists = if(FileSize('$(Path)\CDPOS.QVD') > 0, -1, 0);
IF $(vQvdExists) THEN
MaxSeq:
LOAD MaxString(CHANGENR) as MaxSeq FROM [$(Path)\CDPOS.QVD] (qvd);
LET vIncrementalExpression = ' and CHANGENR >=' & chr(39) & peek('MaxSeq') & chr(39);
DROP table MaxSeq;
ELSE
LET vIncrementalExpression = '';
END IF
TRACE '$(vIncrementalExpression)';
//=================================================================================================================================
CDPOS:
SQL SELECT * FROM CDPOS Where TABNAME = 'MARA' and FNAME = 'MSTAE' and OBJECTCLAS = 'MATERIAL' $(vIncrementalExpression);
//
IF $(vQvdExists) THEN
CONCATENATE (CDPOS) LOAD * FROM $(Path)\CDPOS.QVD (qvd) WHERE NOT exists(CHANGENR);
END IF
//
STORE CDPOS INTO $(Path)\CDPOS.QVD(QVD);
DROP TABLE CDPOS;
//=================================================================================================================================
Boa tarde, Clever.
Muito bom, eu tenho um ID sequencial na tabela, agora estou incrementando por ele.
Obrigado.
Boa tarde, Alessandro.
funcionou perfeitamente, eu tinha um ID na tablela, agora estou incrementando através dele.
Obrigado.