Finding Primary Key Violations
However, before I import the records (tens of thousands) there is a need to find, then handle the legacy DBase records that will cause a Sql Server primary key violation (if any).
Karen Gayda's solution works like a charm:
http://www.sqlteam.com/article/anticipating-primary-key-violations
IMPORTANT: SqlBulkCopy has a column mapper feature. However, only key columns should be included in select parameter - @vcSelectStatement. If source table columns are named differently than in the target then they must be aliased with the same name as the target. These restrictions were necessary to make the procedure generic.
Labels: sql server

1 Comments:
Wow, this stuff is really over my head!! haha But it would be fantastic if we travel together!!
Keep in touch!
Sharon and John Flath
By
Sharon, at 1:06 PM
Post a Comment
<< Home