Possible to use bulk insert in SSIS package in diffrent server

Bala Narasimha Challa 466 Reputation points
2022-12-07T14:39:29.827+00:00

Hi Team,

Have flat file in one server and have created SSIS package in different server. Am trying to load data from flat file to SQL database using SSIS package and inside package am using bulk insert task to insert data to table.

when am trying to execute, am getting access denied error or resultset not set properly error

Could anyone help on this ?

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

3 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,586 Reputation points
    2022-12-07T16:55:22.25+00:00

    Hi @Bala Narasimha Challa ,

    It is better to use a built-in SSIS Bulk Insert Task.
    Check it out here: bulk-insert-task-in-ssis

    One of the benefits of the SSIS Bulk Insert Task is that it allows to configure a connection to the source file.
    That file location and name could be different for dev. vs. test vs. prod. environments.

    So, you will have two tasks on the Control Flow:

    1. Execute SQL Task, to truncate a destination table.
    2. Bulk Insert Task, to load data from the file into a destination table.
    1 person found this answer helpful.
    0 comments No comments

  2. Bala Narasimha Challa 466 Reputation points
    2022-12-07T16:04:33.15+00:00

    Error Message:
    -load " failed with the following error: "Cannot bulk load because the file "D:\FTP\DailySales.txt'" could not be opened. Operating system error code 5(Access is denied.).".
    Possible failure reasons: Problems with the query,
    "ResultSet" property not
    set correctly, parameters not set correctly, or connection not established correctly.

    SQL Script
    TRUNCATE TABLE SalesData

    -- Toad data from text file
    BULKINSERT MyDB.dbo.SalesData
    FROM 'D:\FTP\DailySales.txt'
    WITH
    (
    FIELDTERMINATOR = '\t'
    FIRSTROW = 2.
    KEEPNULLS,
    ROWTERMINATOR = \n'
    )
    GO

    268256-capture20221207212822236.png268314-capture20221207212814090.png268275-capture20221207212808778.png

    268282-capture20221207213358838.png

    0 comments No comments

  3. ZoeHui-MSFT 41,491 Reputation points
    2022-12-08T07:12:29.017+00:00

    Hi @Bala Narasimha Challa ,

    "Cannot bulk load because the file "D:\FTP\DailySales.txt'" could not be opened. Operating system error code 5(Access is denied.)

    From the error message, it is a permission issue.

    Try to give SQL server account permission to access to the file.

    Regards,

    Zoe Hui


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

    0 comments No comments

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.