DTS Import from XLS question

  • Hi All,

    Given a spreadsheet with two columns which will be imported into a table with multiple fields, and the need to increment the primary key for each insertion, what am I missing in this DTS?

    Transformation script:

    '  Copy each source column to the destination column

    Function Main()

     DTSDestination("TrunkGroupID") = DTSLookups("getNextTGID").Execute

     DTSDestination("TrunkGroupName") = DTSSource("TG")

     DTSDestination("fyiBridgeName") = DTSSource("BRIDGE")

     DTSDestination("BridgeID") = 0

     DTSDestination("StatusFlag") = "Active"

     Main = DTSTransformStat_OK

    End Function

    The Lookup query:

    SELECT     ISNULL(MAX(TrunkGroupID), 0) + 1 AS Expr1

    FROM         gcTrunkGroup

    The error is on attempting to add a duplicate primary key.  My DBA has suggested that, rather than committing the insert of each row right away, a group of inserts is being batched which results in the error.  I have been unable to find where I would tell the DTS to commit each insert as it happens.

    Thoughts?

    TIA!

    Marshall

     

  • This was removed by the editor as SPAM

  • Have you thought of changing the TrunkGroupID column to use identity? If you are just incrementing based on the existing columns max value then using the identity property of that column should solve the problem.

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

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