I am now copying data from one client database DB2
to main database DB1
by using SqlBulkCopy
.
DataTable dtTable = new DataTable();
sqlDB2DataAdapter.Fill(dtTable); //select * from tblOrdersDB2
SqlBulkCopy bulkcopy = new SqlBulkCopy(sqlDB1Connection)
bulkcopy.DestinationTableName = "dbo.tblOrdersDB1";
bulkcopy.WriteToServer(dtTable);
By creating INDEX ,when I will insert data with bulk to db, all duplicate values will not inserted.
The problem is I want to report a CSV file of all duplicate records being ignored.
How can I achieve this duplicate records?Is there a simple way to do that?
Thank you.