1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| DROP TABLE TBL_TEMP
CREATE TABLE TBL_TEMP (NATURE nchar(10), STATUT nchar(1), ACC_CODE nchar(3) , ACC_DESCRIPTION varchar(20), CMP_CODE varchar(3),
CMP_DESCRIPTION varchar (20) , GL_ACC_CODE varchar(15), REC_BANK_MVT_ID int, BANK_FLOW_CODE varchar(13) , IBC_DESCRIPTION varchar(30), LIBELLE_BANCAIRE varchar(30),
SENSE_FLAG smallint, RECONCILIATION_ID int, REC_DATE DATETIME, BANK_CUR_CODE varchar(10),
VALUE_DATE DATETIME, ABK_CUR_AMOUNT decimal(19,3), ABK_CUR_CODE nchar(13),TRN_AMOUNT decimal (19,3),
TRN_CUR varchar(13), REC_TYPE_FLAG smallint)
INSERT INTO TBL_TEMP select 'B'as NATURE , 'R' as STATUT, a.ACC_CODE, c.description ACC_DESCRIPTION, c.CMP_CODE, d.Description "CMP_DESCRIPTION", c.GL_ACC_CODE,
REC_BANK_MVT_ID, a.BANK_FLOW_CODE, b.description IBC_DESCRIPTION, a.description LIBELLE_BANCAIRE,
SENSE_FLAG, RECONCILIATION_ID, REC_DATE, a.BANK_CUR_CODE, VALUE_DATE, ABK_CUR_AMOUNT,
a.ABK_CUR_CODE, TRN_AMOUNT,TRN_CUR, REC_TYPE_FLAG
FROM REC_BANK a WITH (INDEX (IF1_REC_BANK)) INNER JOIN IBC_CODES b ON a.BANK_FLOW_CODE = b.IBC_CODE
INNER JOIN ACCOUNTS c ON a.ACC_CODE = c.ACC_CODE
INNER JOIN COMPANIES d ON c.CMP_CODE = d.CMP_CODE
SELECT * FROM TBL_TEMP |
Partager