Search code examples
sql-servervisual-studio-2008ssisoledb

Is it possible to use multiple data sources inside an SSIS package under the OLE DB connection manager?


The query is used for inserting new records only.

How can I use this query? whether the sql script is inside the Execute SQL Task: SQL command task or OLE DB Source: SQL Command task when using 4 different Data sources(databases) such as database A,B,C and D.

In the Data Source under the Solution Explorer, I added four databases under one server, these are database A,B,C and D. Would it be possible to add four databases with four corresponding data source inside the OLE DB connection Manager??

OLE DB connection manager: Database/Data Source A, B, C, D <--- Is this possible??
Data Access Mode:
SQL Command

    SQL Command Text:

    Insert into DWResourceTask.dbo.DimEntity

    select 
    a.EntCode, 
    a.Name, 
    a.Active, 
    a.AccessLevel, 
    a.SiteURN, 
    a.CompanyURN,
    a.SiteName, 
    a.SiteDesc, 
    a.SiteURL
    from 
    (Select e.EntCode, e.Name, e.Active, e.AccessLevel, ss.SiteURN, ss.CompanyURN,
    ss.SiteName, ss.SiteDesc, ss.SiteURL
    from A.dbo.Site ss, A.dbo.LegalEnt e
    where ss.localsiteflag = 1
    and e.active = 1

    UNION ALL
    Select e.EntCode, e.Name, e.Active, e.AccessLevel, ss.SiteURN, ss.CompanyURN,
    ss.SiteName, ss.SiteDesc, ss.SiteURL
    from B.dbo.Site ss, B.dbo.LegalEnt e
    where ss.localsiteflag = 1
    and e.active = 1

    UNION ALL
    Select e.EntCode, e.Name, e.Active, e.AccessLevel, ss.SiteURN, ss.CompanyURN,
    ss.SiteName, ss.SiteDesc, ss.SiteURL
    from C.dbo.Site ss, C.dbo.LegalEnt e
    where ss.localsiteflag = 1
    and e.active = 1

    UNION ALL
    Select e.EntCode, e.Name, e.Active, e.AccessLevel, ss.SiteURN, ss.CompanyURN,
    ss.SiteName, ss.SiteDesc, ss.SiteURL
    from D.dbo.Site ss, D.dbo.LegalEnt e
    where ss.localsiteflag = 1
    and e.active = 1
    )a

    where not exists (select * from DWResourceTask.dbo.DimEntity w
                      where(a.EntCode=w.EntCode
                            and a.Name=w.Name
                            and a.Active=w.Active
                            and a.AccessLevel=w.AccessLevel
                            and a.SiteURN=w.SiteURN
                            and a.CompanyURN=w.CompanyURN
                            and a.SiteName=w.SiteName
                            and a.SiteDesc=w.SiteDesc
                            and a.SiteURL=w.SiteURL))

Please Help. Thanks in Advance!


Solution

  • I will elaborate on the Data Flow task for you. Hopefully this helps.

    1. Drop in a Data Flow task to your workflow. Mine below is called "Load CSV to SQL RawData Table".

    enter image description here

    1. Within the Data Flow task, add your origin (Source) and destination. These can be flat files, database connections, etc. enter image description here

    2. Within the origin, select the Connection and columns you'd like to include. enter image description here

    3. Open up your destination and select the Connection and table to which the data is going to go. enter image description here

    4. Next, map the origin columns to the destination columns. You can do this manually, or by right-clicking and Matching on Name. That's it for that connection. enter image description here

    5. Repeat this process for your other Source and Destinations as part of your overall process flow.

    6. Test your SSIS package, then deploy.