OLE DB Source using T-SQL or SQL Server Stored Procedure

Bobby P 231 Reputation points
2022-03-07T17:08:09.24+00:00

I'd like to know what the general consensus is on using straight T-SQL or a SQL Server Stored Procedure as a SQL command within a Data Flow Task and an OLE DB Source.

Our shop doesn't really have a standard on one as opposed to the other. I guess maybe what I'm looking for are advantages and disadvantages of both.

Personally, I'd prefer straight T-SQL within the SSIS Package. To me, it seems as though that's one less entity you have to worry about for maintaining...deploying...etc..

I of course welcome your thoughts and reasoning on the subject.

Thanks in advance for your input.

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
Developer technologies Transact-SQL
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,586 Reputation points
    2022-03-07T19:41:00.16+00:00

    Hi @Bobby P ,

    My 2 cents:

    • Stored procedure (SP) is easier to create, modify, and test on its own.
    • SP is easier to deploy across environments.
    • SP could be under a source control. On the other hand, SSIS package impossible to compare in a source control because it is XML.

    But for a simple SELECT statement it is ok to be used in an SSIS Source Adapter.

    1 person found this answer helpful.
    0 comments No comments

  2. Tom Phillips 17,771 Reputation points
    2022-03-07T20:06:46.22+00:00

    You will be much happier if you use SSIS for as little as possible.

    If you embed queries in SSIS, they are impossible to test outside of SSIS, and if you need to change logic it is in the SSIS package.

    SP are much easier to manage and source control, as long as they return the same values SSIS will work fine. If you add something to the return set, you will need to update the SSIS package to reflect those new values.

    1 person found this answer helpful.
    0 comments No comments

  3. ZoeHui-MSFT 41,491 Reputation points
    2022-03-08T07:39:57.167+00:00

    Hi @Bobby P ,

    From my point, if the SQL command is simple or not frequently use in the package, I would like to use straight T-SQL.

    If the command is a bit complex or need to be often using, I preferred to use SP.

    Generally speaking, it depends on your own habits. Both of them have advantages and disadvantages.

    Regards,

    Zoe


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.