SSIS BULK UPDATE

  • Hi,

    I designed an SSIS package which includes "BULK UPDATE" part.

    Table1([ID],[Status])

    1.Execute SQL Task: (GetResultSet)

    I put all the IDs into ResultSet Variable. that their Status need to get updated.

    2.Foreach Loop Container:

    Uses enumarator which iterates the IDs row by row from the ResultSet variable.

    3.Execute SQL Task: (UpdateStatus)

    Runs inside of the Foreach Loop Container and UPDATE the [Status] field in Table1

    UPDATE Table1 SET Status = 2 WHERE ID = ?

    This BULK UPDATE part takes very long time to process.

    What I would prefer is:

    Run Execute SQL Task without using Foreach Loop Container which can run a query like:

    UPDATE Table1 a INNER JOIN [User::ResultSet] b ON a.ID=b.ID SET Status = 2

    OR

    UPDATE Table1 SET Status = 2 WHERE ID IN (SELECT * FROM [User::ResultSet])

    The problem is I could not manage to EITHER join to [User::ResultSet] variable OR select from that.

    Anyone can suggest any workaround?

    Thanks,

    /Day

  • Why not just use a data flow task to insert the data into a table or temp table on the server that holds the table you want to update?

  • Hi Michael,

    Thank you for your repsonse.

    I resolved the problem using Dataflow.

    Because there is no index set on the ID field, it is taking a long time to match those records from Table1 but compare to foreach loop container it is faster.

    Thanks again for the help.

  • This was removed by the editor as SPAM

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply