----------------------------------------------
-- SQL Server Table SPE pour 36
----------------------------------------------

drop table DATAMART_036_1;

select DOCUMENTS.DOC_CODE_ARTICLE, DOCUMENTS.DOC_CODE_FOURNISSEUR, DOCUMENTS.DOC_CODE_SOUS_FAMILLE, DOCUMENTS.DOC_DATE_PERIODE_CDE, DOCUMENTS.DOC_ETAT_CDE, DOCUMENTS.DOC_MONTANT_LIGNE_CDE
into DATAMART_036_1
from DOCUMENTS
where DOCUMENTS.DOC_TYPE_TRANSACTION = 'CA' and (DOCUMENTS.DOC_ETAT_CDE <> 'A');

create index DATAMART_036_01_IDX_01 on DATAMART_036_1(DOC_DATE_PERIODE_CDE);
