How do I import an Excel spreadsheet into SQL Server 2008R2 database?(如何将 Excel 电子表格导入 SQL Server 2008R2 数据库?)
问题描述
我在 Excel 工作表中获得了大量联系信息列表,我想将其转换为数据库中的表格,以便我可以在数据库中维护它们.
I have got huge list of contact information in an Excel sheet that I would like to turn into table in the database so that I can maintain them in the database.
我尝试从 SQL Server 2008 R2 执行导入/导出平面文件导入,但没有奏效.谁能告诉我如何将电子表格成功导入数据库中的表格?
I tried following the import/export flat file import from the SQL Server 2008 R2, but it did not work. Can anyone tell me how do I successfully import the spreadsheet into a table in the database?
谢谢
推荐答案
有一篇微软知识库文章列出了所有可能的方法.
There is a microsoft knowledge base article that lays out all the ways this is possible.
http://support.microsoft.com/kb/321686
我认为使用 OPENROWSET 或 OPENDATASOURCE 将是最简单的方法,无需向导.(见分布式查询)
I think using OPENROWSET or OPENDATASOURCE will be the easiest way, without the wizard. (see Distributed Queries)
SELECT * INTO XLImport4 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C: estxltest.xls', [Customers$])
请参阅 OPENROWSET 文档,以及页面下方的示例.
See OPENROWSET documentation, with examples lower down the page.
http://msdn.microsoft.com/en-us/library/ms190312.aspx
手动
右键单击数据库名称/转到任务然后选择导入数据,作为源选择您之前创建的excel文件并在下一页选择它的路径选择sql server作为目标
Right click on the database name/go to task and then select import data, as a source select an excel file that you created before and choose it's path on the next page select sql server as destination
这篇关于如何将 Excel 电子表格导入 SQL Server 2008R2 数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 Excel 电子表格导入 SQL Server 2008R2 数据库?
基础教程推荐
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 在多列上分布任意行 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
