Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using SSIS Data Flow Task to transfer records from table in 1 SQL Server database to an IDENTICAL table in another SQL Server (2012) and getting "Violation of PRIMARY KEY constraint 'FLG_APVN_KEY_0'. Cannot insert duplicate key in object 'dbo.FLG_APVN'. The duplicate key value is ("ARIZ0010 ).". In the Source table (FLG_APVN), there are two records with the following Primary Key values: "ARIZ0010 and ARIZ0010 Obviously similar but definitely distinct. The quotation mark at the beginning of the first PK Value seems to be getting dropped off by SSIS in the insert causing a primary key violation. I need both records in the destination table with their primary keys intact. How do I do this? (SQL Server 2012, SSIS from Visual Studio 2012).

share|improve this question

closed as off-topic by Jon Seigel, RolandoMySQLDBA, Max Vernon, Michael - sqlbot, bluefeet Oct 20 '13 at 13:55

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Too localized - this could be because your code has a typo, basic error, or is not relevant to most of our audience. Consider revising your question so that it appeals to a broader audience. As it stands, the question is unlikely to help other users (regarding typo questions, see this meta question for background)." – Jon Seigel, RolandoMySQLDBA, Max Vernon, Michael - sqlbot, bluefeet
If this question can be reworded to fit the rules in the help center, please edit the question.

Can you describe the Data Flow Task? What type of Source, Destination etc? – Kenneth Fisher Oct 18 '13 at 21:15
Can you update on of them and after moving update again and roll it back? – Amirreza Keshavarz Oct 18 '13 at 21:29
Thanks guys. While doing some more digging I determined that a previous step in the SSIS Package wasn't clearing the table of the correct records before attempting to re-write them back into the table. Tough to notice on a table with hundreds of thousands of records!!! Anyway, it's working now. Thanks again! – JimInAZ Oct 19 '13 at 0:19

Solved. See Comment above. Turns out that the quotation mark wasn't the problem.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.