比较excel列名和sql列名 [英] compare excel column name with sql column name

查看:102
本文介绍了比较excel列名和sql列名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带列名的SQL表,没有数据.我有另一个具有列名和数据的Excel工作表.我需要将数据从Excel导入到sql表.在此之前,我需要比较sql列名称和excel列名称.如果没关系,则只需将其导入.


请帮助我清楚的编码. c#

I have a SQL table with column name and no data. i have another excel sheet with column name and data. i need to import the data from excel to sql table. Before that i need to compare sql column names and excel column names. if thats ok then only it needs to be imported.


Please Help me with clear coding. code in c#

推荐答案

中的代码要访问Excel电子表格,您可以使用 EPPlus [^ ]

SQL Server管理对象 [数据库表 [ [ ^ ]属性,可用于访问每个专栏 [ ^ ].

然后,您可以比较名称 [ ^ ]列与Excel电子表格中的列名称相对应.

最好的问候
Espen Harlinn
For access to the Excel spreadsheet you can use EPPlus[^]

SQL Server Management Objects [^] provides an easy to use API for accessing meta information, such as column names.

The Database.Tables[^] property provides access to the tables in the database, and the Table class has a Columns[^] property that you can use to access each Column[^] of the table in question.

You can then compare the Name[^] of the column against the column name from the Excel spreadsheet.

Best regards
Espen Harlinn


您可以使用SQL Server导入导出向导,该向导将要求您将excel列映射到SQL.或使用集成服务项目 [
You can either use SQL server Import export wizard which will ask you mapping the excel column to SQL. or use Integration service project[^] to begin with.


这篇关于比较excel列名和sql列名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆