Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PK of Entity not set after bulk copy #392

Open
boomgetchopped opened this issue Jul 1, 2024 · 1 comment
Open

PK of Entity not set after bulk copy #392

boomgetchopped opened this issue Jul 1, 2024 · 1 comment

Comments

@boomgetchopped
Copy link

boomgetchopped commented Jul 1, 2024

Hello, is there a way for bulkcopy to set the PKs of the records inserted? I need to use the PK values in subsequent save operations after the bulkcopy. Thanks.

Using MS Sql Server

@MaceWindu
Copy link
Contributor

Bulk copy doesn't provide such functionality so some of your options are:

  1. set ids on client before instert (and allow identity insert if identity pk used)
  2. load records after bulk copy
  3. insert using MergeWithOutput to return generated ids and then assign them manualy
  4. for ids, generated by sequence: use DataExtensions.RetrieveIdentity to assign ids to entities using database sequence and then insert them using bulk copy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants