SQL Server:如何导入Excel创建表? [英] SQL Server : how to import Excel to create a table?

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

问题描述

我真的很新的数据库管理。从这个问题我期望的是
a清楚的指导如何实现这一点以及如何设置SQL Server。



具有三列的Excel文件是这样的:

  ItemCode描述价格
a01苹果10
a02橙色20
a03菠萝10
a04火30
a05 tim 35
a06 keny 25
a07 peter 20
a08 tom 21
a09鼠标​​23
a10键盘45

我正在使用SQL Server 2008 Express版本。但是我在安装过程中跳过了一些事情,如失败的PerfMonCounterNotCorruptedCheck。任何方式我完成安装。



我去导入/导出到SQL Server,我从Excel中选择源,并将目标服务器像SQL Server Native Client和服务器设置为 CNG9130xxxx 。它显示从Excel导入的记录从表中成功形成数据库中的表。但是,在我关闭之后,我找不到新创建的数据库文件,我应该在哪里输入SQL命令来提取一些数据列表,表示Price< 21



<任何想法?



或者我应该去像SQL Server 2014 Express那样的更新版本?



提前感谢

解决方案

如果您使用SQL Server Management Studio,请按照下列步骤操作:


  1. 从SQl Server Mgmt的对象资源管理器。 Studio,右键单击您的数据库名称。

  2. 选择任务>导入数据

  3. 在SQL Server导入和导出向导中,选择 Microsofrt Excel .Next

  4. 将目标设置为 SQL Server Native Client 11.0

  5. 输入您的服务器名称验证数据库

  6. 选择从一个或多个表或视图复制数据。下一步

  7. 选择excel的工作表名称,然后从右侧列修改表名称。

  8. 立即显示。

您的新表可以使用了。 >

I am really new to database management. What I expect from this question is a clear guideline on how to achieve this and how to set up SQL Server.

The Excel file with three columns is like this:

ItemCode    Description Price
a01         apple       10
a02         orange      20
a03         pineapple   10
a04         fire        30
a05         tim         35
a06         keny        25
a07         peter       20
a08         tom         21
a09         mouse       23
a10         keyboard    45

I am using SQL Server 2008 Express edition. But I skip some things during installation like "Failed PerfMonCounterNotCorruptedCheck". Any way I completed the installation.

I go to import/export into SQL Server, I choose source from Excel and set the destination server like "SQL Server Native Client" and server to CNG9130xxxx. It shows the records from Excel is imported to form a table in database to from table successfully. But, after I hit close, I just can not locate the newly-created database file and where should I type SQL command to extract some data list says the list of Price<21

Any ideas?

Or should I go for some later version like SQL Server 2014 Express?

Thanks in advance

解决方案

If you are using SQL Server Management Studio, then follow these Steps:

  1. From the object explorer of SQl Server Mgmt. Studio, right click on your database name.
  2. Select Tasks > Import Data
  3. In SQL Server Import and Export Wizard, Select Microsofrt Excel.Next
  4. Set Destination as SQL Server Native Client 11.0.
  5. Enter your Server Name,Authentication,Database. Next
  6. Select Copy data from one or more table or views. Next
  7. Select the sheet name of your excel and modify the table name from right side column. Next.
  8. Excecute immediately.

Your new table is ready to use.

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

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