question

vnky avatar image
vnky asked

Import DBF or Excel file into SQL Server with dynamic column mapping using C#.Net

Recently, I've been importing a DBF file of approx 50 to 250 millions records with discrete columns structure into database table. Suppose I'm having an database table "RawUpload" which consists of 68 columns to save uploaded details. This database Table structure is same for dbase/Excel file for unMapped columns. Consider a case where dbase File A1 has column name 'TrxnNo' and in another File A2 has column name 'TrxnNum' Or 'TradeNo' which alternately mapped to the database table column TransactionNumber nvarchar(255). Similarly, their are approx. 10 to 30 column in files which can changed frequently. It's hard to track them, so i wanted to go with dynamic column Mapping with database table at runtime. To accomplish this task I've tried following cases : 1) Using SSIS package but not able to do with dynamic column structure. 2) Using SqlBulkCopy which taking more time to complete and even results to timeout and application hang state. 3) Using DTS (Interop.DTS) package works fine but fails for huge records. Now my questions here is: which is the fastest way to import such big files into a SQL Server table with dynamic column mapping which will work for large data ? Thanks
sql server 2012c#.net
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.