如何通过sql 2005中的“select statement”从excel获取数据?

时间:2022-10-07 17:52:49

is there any method to get data from excel to sql ? i think that we can do without any writing C#codes. For example : select * from MyExcellFile.xls.Sheet1. Or may be any wizard in sql?

有没有什么方法可以将数据从excel传递到sql?我认为我们可以不用任何编写C#代码。例如:从MyExcellFile.xls.Sheet1中选择*。或者可能是sql中的任何向导?

3 个解决方案

#1


3  

See if this page with example of using OPENDATASOURCE helps.

查看此页面是否有使用OPENDATASOURCE的示例有帮助。

EDIT: Towards the bottom of the page, you will see an example of a query that uses excel as its source.

编辑:在页面底部,您将看到一个使用excel作为其源的查询示例。

#2


1  

You can save your EXCEL file as CSV file, and then you can use the following site in order to TRANSFORM the CSV file into a succession of INSERT statements:

您可以将EXCEL文件保存为CSV文件,然后可以使用以下站点将CSV文件转换为一系列INSERT语句:

http://csv2sql.evandavey.com/

(FREE Online CSV to SQL Converter)

(免费在线CSV到SQL转换器)

Please be careful to avoid submitting sensitive data to the site, for obvious privacy reasons.

出于明显的隐私原因,请小心避免向网站提交敏感数据。

#3


0  

Easiest way is via the SSIS/DTS wizard. Right click on the database in SQL Server, choose Tasks then Import Data. One of the source data options is an Excel spreadsheet. You can them import it into it's own table in SQL Server or map the columns into existing tables. This is the easiest way for a one time upload.

最简单的方法是通过SSIS / DTS向导。右键单击SQL Server中的数据库,选择“任务”,然后选择“导入数据”。其中一个源数据选项是Excel电子表格。您可以将它们导入到SQL Server中自己的表中,或将列映射到现有表中。这是一次性上传的最简单方法。

#1


3  

See if this page with example of using OPENDATASOURCE helps.

查看此页面是否有使用OPENDATASOURCE的示例有帮助。

EDIT: Towards the bottom of the page, you will see an example of a query that uses excel as its source.

编辑:在页面底部,您将看到一个使用excel作为其源的查询示例。

#2


1  

You can save your EXCEL file as CSV file, and then you can use the following site in order to TRANSFORM the CSV file into a succession of INSERT statements:

您可以将EXCEL文件保存为CSV文件,然后可以使用以下站点将CSV文件转换为一系列INSERT语句:

http://csv2sql.evandavey.com/

(FREE Online CSV to SQL Converter)

(免费在线CSV到SQL转换器)

Please be careful to avoid submitting sensitive data to the site, for obvious privacy reasons.

出于明显的隐私原因,请小心避免向网站提交敏感数据。

#3


0  

Easiest way is via the SSIS/DTS wizard. Right click on the database in SQL Server, choose Tasks then Import Data. One of the source data options is an Excel spreadsheet. You can them import it into it's own table in SQL Server or map the columns into existing tables. This is the easiest way for a one time upload.

最简单的方法是通过SSIS / DTS向导。右键单击SQL Server中的数据库,选择“任务”,然后选择“导入数据”。其中一个源数据选项是Excel电子表格。您可以将它们导入到SQL Server中自己的表中,或将列映射到现有表中。这是一次性上传的最简单方法。