简体   繁体   English

C#代码将Excel数据导入到SQL Server 2008中

[英]C# code to Import Excel data in to SQL server 2008

My question which is the best approach to import the data from Excel to SQL server 2008. It has lots of check like duplicates check etc., 我的问题是将数据从Excel导入SQL Server 2008的最佳方法。它有很多检查,例如重复检查等,

I would say we have 我会说我们有

1.Import Export wizard 1.导入导出向导
2.SSIS package 2.SSIS包
3.Create a .NET Console App with inline query 3,使用内联查询创建.NET控制台应用
4.Create a .NET console app with stored proc because it has lots of checking conditions. 4.使用存储的proc创建一个.NET控制台应用程序,因为它具有很多检查条件。

Which is the best approach? 哪种方法最好?

thanks in advance 提前致谢

You can debate over option 2 and 4. The choice will mainly depend on if the job requires to run periodically. 您可以就选项2和4进行辩论。选择主要取决于作业是否需要定期运行。 If yes - I will go ahead with SSIS package otherwise I will go ahead with .NET console app with the logic to be in a SP. 如果是,我将继续使用SSIS包,否则,我将继续使用.NET控制台应用程序,其逻辑应包含在SP中。

Quick suggestions - Implement logging for failed rows. 快速建议-对失败的行实施日志记录。 So that you can run a job to retry. 这样您就可以运行作业以重试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM