Solved

SSIS - SQL script

Posted on 2014-02-18
3
216 Views
Last Modified: 2016-02-10
Hi

 Can I run a SQL involving multiple tables in SSIS? So far I can seem to pull data from a single table using Data flow?
0
Comment
Question by:LuckyLucks
  • 2
3 Comments
 
LVL 35

Expert Comment

by:David Todd
ID: 39869515
Hi,

Maybe this is too obvious, but create a view, and use that as a data source.

Regards
  David
0
 
LVL 37

Assisted Solution

by:ValentinoV
ValentinoV earned 500 total points
ID: 39869761
It's supported, even without a view.  If you open the properties of the OLE DB Source, you'll see a dropdown called Data access mode.  The default is Table or view but this is not a recommended practice (it's the equivalent of SELECT *).  Change it to SQL command and you'll be able to enter any SELECT statement there, including one with joins to other tables.
0
 
LVL 37

Accepted Solution

by:
ValentinoV earned 500 total points
ID: 39869764
BTW: whenever I need a complex query as source I usually put it in a stored procedure.  The reason for this is because these types of query are prone to changes and when you're dealing with a production environment on which you don't have any write access, you want to minimize the change impact.  In this case you wouldn't need to modify the SSIS package when the source query logic changes, as long as the output fields remain the same of course.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My client sends data in an Excel file to me to load them into Staging database. The file contains many sheets that they have same structure. In this article, I would like to share the simple way to load data of multiple sheets by using SSIS.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question