如何将 Excel 电子表格导入 SQL Server? [英] How do I import an excel spreadsheet into SQL Server?

查看:52
本文介绍了如何将 Excel 电子表格导入 SQL Server?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将一个 Excel 电子表格导入 SQL Server 2005.我需要采取哪些步骤来完成这项工作?

I need to import an excel spreadsheet into SQL Server 2005. What steps would I need to take to accomplish that?

推荐答案

数据转换服务"向导是您的朋友.

The "Data Transformation Services" wizards are your friend.

此处的说明假设 SQL Server 2000

The instructions here assume SQL Server 2000

  • 打开 SQL Server 企业管理器
  • 右键单击相应的服务器
  • 选择导入数据
  • 运行向导.
    • 在第一个屏幕上点击下一步
    • 选择Microsoft Excel"作为您的数据源
    • 输入 XLS 文件的路径,然后单击下一步.
    • 输入数据库的连接详细信息,然后单击下一步.

    根据您想对数据做什么,您有几个新选项.对于一次性工作,我通常发现最简单的方法是导入所有 excel 数据,然后在 SQL Server 中对其进行编辑,但是如果您要对多个文件重复此操作,您可能需要制作一个非常吸引人的导入脚本.

    Depending on what you want to do with the data, you have a few options new. For one-off jobs I generally find it easiest to import all the excel data, then edit it in SQL Server, but if you're going to repeat this action on multiple files, you might want to craft a really sexy import script.

    如果您要再次运行它,您可以使用向导保存 DTS 包,然后在企业管理器的数据转换服务"部分中对其进行编辑.这是了解 DTS 工作原理的好方法.

    If you are going to run it again, you can save the DTS package using the wizard, then edit it in the "Data Transformation Services" section of Enterprise Manager. It's a good way to learn how DTS works.

    这篇关于如何将 Excel 电子表格导入 SQL Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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