Forum Discussion
gnanny
Mar 30, 2023Copper Contributor
Bulk Insert causing duplicates in target table
We use ETL tool(C# based) which uses Bulkcopy method to do bulk insert to target table. Recently we are facing 2 Issues in our daily loads 1. Target table with no primary key - the load returns ...
LainRobertson
Mar 31, 2023Silver Contributor
Do you mean the .NET SqlBulkCopy class (referenced below), or some method from another class?
If it's the SqlBulkCopy class that you're talking about then you're looking at the wrong end: it's not your destination table(s) at fault; it's the source table/query used to generate the data.
The target table is akin to a dumb terminal that receives whatever is contained in the source table or query, so the problem is definitely not at that end - or perhaps I should clarify and say that it's the SqlBulkCopy.WriteToServer() is not the cause of the fault (since if your package contains additional code after the bulk copy's WriteToServer() then I suppose anything is possible.)
Cheers,
Lain