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.
我在Excel表格中有大量的联系信息,我想在数据库中转换成表格,以便我可以在数据库中维护它们。
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?
我尝试从SQL Server 2008 R2导入导入/导出平面文件,但它不起作用。谁能告诉我如何成功将电子表格导入数据库中的表?
Thanks
1 个解决方案
#1
3
There is a microsoft knowledge base article that lays out all the ways this is possible.
有一篇微软知识库文章列出了所有可能的方法。
http://support.microsoft.com/kb/321686
I think using OPENROWSET or OPENDATASOURCE will be the easiest way, without the wizard. (see Distributed Queries)
我认为使用OPENROWSET或OPENDATASOURCE将是最简单的方法,没有向导。 (请参阅分布式查询)
SELECT * INTO XLImport4 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\test\xltest.xls', [Customers$])
See OPENROWSET documentation, with examples lower down the page.
请参阅OPENROWSET文档,页面下方有示例。
http://msdn.microsoft.com/en-us/library/ms190312.aspx
Manually
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作为目标
#1
3
There is a microsoft knowledge base article that lays out all the ways this is possible.
有一篇微软知识库文章列出了所有可能的方法。
http://support.microsoft.com/kb/321686
I think using OPENROWSET or OPENDATASOURCE will be the easiest way, without the wizard. (see Distributed Queries)
我认为使用OPENROWSET或OPENDATASOURCE将是最简单的方法,没有向导。 (请参阅分布式查询)
SELECT * INTO XLImport4 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\test\xltest.xls', [Customers$])
See OPENROWSET documentation, with examples lower down the page.
请参阅OPENROWSET文档,页面下方有示例。
http://msdn.microsoft.com/en-us/library/ms190312.aspx
Manually
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作为目标