Search code examples
sqlsql-serverssisetldata-warehouse

How to fix an OLE DB error in SQL Server Data Tools


I'm trying to transfer columns from database tables into a fact table in a data warehouse.

I'm using the following SQL command to retrieve data

SELECT employée.matricule, accident.[code accident], prestataire.[N°], 
visite.[date visite], accident.[date accident] ,remboursement.[montant rem], visite.[Nbre Jours Acc] 
FROM 
    visite, employée, accident, prestataire, remboursement, bordereaux
WHERE 
    employée.matricule=accident.matricule AND 
    employée.matricule= visite.matricule AND
    prestataire.valeur = bordereaux.prestataire AND
    bordereaux.matricule = employée.matricule AND
    remboursement.[numéro du bulletin] = bodereaux.[numéro du bulletin]

The column [numéro du bulletin] exists in the table "bodereaux" and "remboursement" but I don't understand why I keep getting this error

Error 2
Validation error. Data Flow Task OLE DB Source [48]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E14. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E14 Description: "Statement(s) could not be prepared.". An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E14 Description: "The multi-part identifier "bodereaux.numéro du bulletin" could not be bound.". FaitAccident.dtsx 0 0


Solution

  • Try using the following query:

    SELECT 
        employée.matricule, 
        accident.[code accident], 
        prestataire.[N°], 
        visite.[date visite], 
        accident.[date accident], 
        remboursement.[montant rem], 
        visite.[Nbre Jours Acc] 
    FROM 
        visite INNER JOIN employée ON employée.matricule = visite.matricule
               INNER JOIN accident ON employée.matricule = accident.matricule
               INNER JOIN bordereaux ON bordereaux.matricule = employée.matricule
               INNER JOIN remboursement ON remboursement.[numéro du bulletin] = bodereaux.[numéro du bulletin]
               INNER JOIN prestataire ON prestataire.valeur = bordereaux.prestataire