How to TRUNCATE or empty a SQL Server table within SSIS Data Flow

Scott Johnson 1 Reputation point
2021-10-07T14:36:38.803+00:00

I do understand that I can simply add a TRUNCATE TABLE command inside an EXECUTE SQL TASK within my Control Flow, prior to calling my Data Flow. However, I want to do this within the Data Flow instead? There is a reason I want to do it this way I just don't want to get into the long explanation as to why. Has anyone ever done this?

Thanks in advance.

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

1 answer

Sort by: Most helpful
  1. ZoeHui-MSFT 41,491 Reputation points
    2021-10-08T05:46:07.733+00:00

    Hi @Scott Johnson ,

    You may use OLE DB Command Transformation in Data Flow.

    The OLE DB Command transformation runs an SQL statement for each row in a data flow. For example, you can run an SQL statement that inserts, updates, or deletes rows in a database table. I tested that it could also truncate the table.

    ole-db-command-transformation

    Regards,

    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    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.
    Hot issues October


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.