Import Flat File wizard is a new feature implemented in SQL Server Management Studio (SSMS) v17.3 for importing a .csv or a .txt file into a SQL Server database.

导入平面文件向导是SQL Server Management Studio(SSMS)v17.3中实现的一项新功能,用于将.csv或.txt文件导入SQL Server数据库。

The latest SSMS version can be found on this link

在此链接上可以找到最新的SSMS版本

To invoke the Import Flat File wizard, go to Object Explorer, select a database you want to use to import data from a .csv or .txt file, right click and from the context menu, choose the Import Flat File option:

要调用导入平面文件向导,请转到对象资源管理器 ,选择要用于从.csv或.txt文件导入数据的数据库,右键单击并从上下文菜单中选择“ 导入平面文件”选项:

This will open the Import Flat File Introduction page providing an overview of the features and showing what needs to be specified in order to successfully import data from a flat file to a SQL Server database.

这将打开“ 导入平面文件 简介”页面,其中概述了功能并显示了需要指定哪些内容才能成功将数据从平面文件导入SQL Server数据库。

If you don’t wish to see this page next time the Import Flat File feature is invoked, just check the Do not show this page again. After that press the Next button to proceed with importing a flat file:

如果您不希望下次调用“导入平面文件”功能时看到此页面,只需选中“不再显示此页面” 。 之后,按“ 下一步”按钮继续导入平面文件:

The next page of the Import Flat File wizard is the Specify Input File page. On this page, we need to set up the location of a flat file which will be used for importing into a SQL Server database. Also, we need to add the name of the table which will be created into a SQL Server database to hold the imported data from a flat file:

导入平面文件向导的下一页是“ 指定输入文件”页面。 在此页面上,我们需要设置平面文件的位置,该文​​件将用于导入到SQL Server数据库中。 另外,我们需要添加将在SQL Server数据库中创建的表的名称,以保存从平面文件导入的数据:

To pick a location of a flat file, click the Browse button. By default, the Import Flat File wizard is set to search for the .csv and .txt files. The Import Flat File wizard allows to pick another file format then .csv and .txt. For example, a .xlsx file format can be selected:

要选择平面文件的位置,请单击“ 浏览”按钮。 默认情况下,“导入平面文件”向导设置为搜索.csv和.txt文件。 导入平面文件向导允许选择其他文件格式,然后是.csv和.txt。 例如,可以选择.xlsx文件格式:

But on the next page of the Import Flat File wizard, the following error message will appear when another file format then .csv or .txt is used:

但是,在“导入平面文件”向导的下一页上,使用其他文件格式(然后是.csv或.txt)时,将出现以下错误消息:

An error occurred while running learn on the input file.
Additional information:
Cannot find patterns in the input file. (Microsoft.SqlServer.Prose.Import)

在输入文件上运行学习时发生错误。
附加信息:
在输入文件中找不到模式。 (Microsoft.SqlServer.Prose.Import)

Let’s go back to the Specify Input File page and, this time, choose the correct file format (e.g. ImportData.csv):

让我们回到“ 指定输入文件”页面,这次,选择正确的文件格式(例如ImportData.csv):

By default, the name of the table in the New table name box will be the name of the imported .csv/.txt file (ImportData).

默认情况下,“新表名称”框中的表名称将是导入的.csv / .txt文件(ImportData)的名称。

The name of the table in which will be imported data can be changed and set whatever is liked as long as the SQL Server table and column naming conventions are followed.

只要遵循SQL Server表和列命名约定 ,就可以更改要在其中导入数据的表的名称并设置所需的值。

The name of a new table should be unique and must not exist in the destination database, otherwise the following message will appear when the Next button is pressed:

新表的名称应该是唯一的,并且在目标数据库中不能存在,否则,当按下“下一步”按钮时,将出现以下消息:

Provided table name already exists.

提供的表名已经存在。

After the unique name for the table is set, press the Next button to continue. The next page of the Import Flat File wizard is Preview Data:

设置表的唯一名称后,按“ 下一步”按钮继续。 导入平面文件向导的下一页是预览数据

This page generates a preview of data that are located in the ImportData.csv file and how they will look like when are generated into a table. The Preview Data page generates max up to first 50 rows.

此页面将生成ImportData.csv文件中数据的预览,以及在表中生成后的外观。 “预览数据”页面最多可生成前50行。

If you are satisfied with the preview, click the Next button to proceed:

如果您对预览感到满意,请单击下一步按钮继续:

On the Modify Columns page wizard analyze the data located in the .csv or .txt file and suggest what it believes that is correct for the column name and data type. The names of the columns, data types, primary key for the table, etc. can be modified/changed:

在“ 修改列”页面向导上,分析位于.csv或.txt文件中的数据,并提出对列名称和数据类型正确的建议。 可以修改/更改列的名称,数据类型,表的主键等:

Once the settings on the Modify Column page are done, click the Next button. The Summary page will appear:

完成“修改列”页面上的设置后,单击“ 下一步”按钮。 将显示“ 摘要”页面:

This page shows the names of SQL Server, database and the name of the table where will data from the imported .csv file be stored.

此页面显示了SQL Server的名称,数据库以及将存储来自导入的.csv文件的数据的表的名称。

Click the Finish button to import data formImpotData.csv file to the ImportData SQL Server table.

单击“ 完成”按钮将数据formImpotData.csv文件导入到ImportData SQL Server表中。

The last page of the Import Flat File wizard is the Results page. This page indicates whether the importing data from the flat file to a SQL Server table was successful or with errors:

导入平面文件向导的最后一页是结果页面。 该页面指示从平面文件到SQL Server表的数据导入成功还是有错误:

Now, when check the AdwnetureWorks2014 database, under the Tables folder, the ImportData table will appear:

现在,当检查AdwnetureWorks2014数据库时,在Tables文件夹下,将显示ImportData表:

When importing data from the flat file to SQL Server database, make sure that you have adequate permissions, otherwise one of the following error message will appear:

将数据从平面文件导入SQL Server数据库时,请确保您具有足够的权限,否则将出现以下错误消息之一:

Error creating table. (Microsoft.SqlServer.Import.Wizard)
Error creating table. (Microsoft.SqlServer.Prose.Import)
CREATE TABLE permission denied in database ‘AdventureWorks2014’. (Microsoft SQL Server, Error: 262)

创建表时出错。 (Microsoft.SqlServer.Import.Wizard)
创建表时出错。 (Microsoft.SqlServer.Prose.Import)
CREATE TABLE权限在数据库'AdventureWorks2014'中被拒绝。 (Microsoft SQL Server,错误:262)

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
The server principal “Zivko” is not able to access the database “AdventureWorks2014” under the current security context. (Microsoft SQL Server, Error: 916)

执行Transact-SQL语句或批处理时发生异常。 (Microsoft.SqlServer.ConnectionInfo)
服务器主体“ Zivko”在当前安全上下文下无法访问数据库“ AdventureWorks2014”。 (Microsoft SQL Server,错误:916)

Error creating table. (Microsoft.SqlServer.Import.Wizard)
Error creating table. (Microsoft.SqlServer.Prose.Import)
The specified schema name “dbo” either does not exist or you do not have permission to use it. (Microsoft SQL Server, Error: 2760)

创建表时出错。 (Microsoft.SqlServer.Import.Wizard)
创建表时出错。 (Microsoft.SqlServer.Prose.Import)
指定的架构名称“ dbo”不存在,或者您没有使用它的权限。 (Microsoft SQL Server,错误:2760)

More about necessary permissions in order to use the Import Flat File wizard successfully can be found on this page

可以在此页面上找到有关成功使用“导入平面文件”向导的必要权限的更多信息。

翻译自: https://www.sqlshack.com/import-flat-file-sql-server-database-using-import-flat-file-wizard/

如何使用导入平面文件向导将平面文件导入SQL Server数据库相关推荐

  1. ExcelToDatabase:批量导入Excel文件到MySQL/Oracle/SQL Server数据库的自动化工具

    ExcelToDatabase:批量导入Excel到MySQL/Oracle/SQL Server数据库的自动化工具 简介 ExcelToDatabase 是一个可以批量导入excel到mysql/o ...

  2. [转载]在SQL Server数据库之间进行数据导入导出,OPENDATASOURCE

    需要在c盘下先建立一个data.txt文件,然后在文件的第一行写上你要导出的列,不如说要导出id和name这两列,就在第一行写上 id,name 然后保存,使用下列SQL就可以了,你如果要保持原有的I ...

  3. 服务器腾讯通文件数据源导入,连接到 Excel 数据源(SQL Server 导入和导出向导)...

    连接到 Excel 数据源(SQL Server 导入和导出向导) 04/02/2018 本文内容 适用于: SQL Server(所有支持的版本) Azure 数据工厂中的 SSIS Integra ...

  4. SQL Server 数据库之导入导出数据

    导入导出数据 1. 概述 2. 导入 SQL Server 数据表 3. 导入其他数据源的数据 4. 导出 SQL Server 数据表 1. 概述 导入数据也是数据库操作中使用频繁的功能,SQL S ...

  5. 如何将数据从Excel文件导入SQL Server数据库

    There are many ways to import data from an Excel file to a SQL Server database using: 有多种方法可以使用以下方法将 ...

  6. MVC3学习:将excel文件导入到sql server数据库

    思路: 1.将excel文件导入到服务器中. 2.读取excel文件,转换成dataset. 3.循环将dataset数据插入到数据库中. 本例子使用的表格为一个友情链接表F_Link(LinkId, ...

  7. 将Excel数据导入SQL Server数据库

    遇到了一个需求,需要将Excel中的数据导入SQL Server数据库中,当然,不是使用企业管理器之类的直接导入数据的那种,而是要做到程序中.本来我最初的考虑是将Excel中的数据读到dataset中 ...

  8. ASP.NET Excel导入到SQL Server数据库

    提供把Excel里的数据导入到SQL Server 数据库,前提是Excel里的字段在Sql Server表里都有,不然会出现错误.注释很详细哦!要引用的命名空间是: using System.Dat ...

  9. 使用T-SQL导入多个文件数据到SQL Server中一文的疑惑

    - 今天,由于毕业论文需要,我想弄数据转换,所以看了一看T-SQL,oracle实在没时间去学,好在SQL我还是很熟悉,所以打算看一看,写一些存储过程来完成任务. 我无意中在csdn上找到这样一篇文章 ...

最新文章

  1. 因果推断研究获2021诺贝尔经济学奖,图灵奖得主Judea Pearl祝贺并反对
  2. API接口调用里的QPS指什么?百度语音API里的QPS实例说明
  3. Leetcode 48. 旋转图像 (每日一题 20210813)
  4. java成绩排名平均成绩_java 数组 输入5名学生的成绩 得出平均分。
  5. Random类——获取随机数
  6. 自定义控件-条状、块状菜单
  7. webpack打包问题
  8. JeewxBoot微信管家平台源码v1.3
  9. js map的get 和list比 那个快_js中let和var
  10. 常用编码软件简单使用记录 1 : 自主编码器
  11. leetCode----day01---- 从排序数组中删除重复项
  12. 【学术技巧】论文答辩,老师会仔细看论文内容吗?
  13. Egoist (罪恶王冠) | mmd动作+镜头下载
  14. php微信测试号配置代码,微信测试号实现微信分享等功能【转载】
  15. 遍历指定文件夹下的所有文件名
  16. CANN训练营第三季_昇腾CANN算子精讲课_TBE算子Sinh开发笔记_UT测试(三)
  17. 缓解论文写作压力的小妙招
  18. 基于Windows8与Visual Studio11开发第一个ring3驱动程序
  19. html5页面上下分栏,HTML5+CSS3 分栏效果
  20. 【JPG到DWG】图片直转成CAD

热门文章

  1. 【习题 7-2 UVA-225】Golygons
  2. zoj 2112 树状数组 套主席树 动态求区间 第k个数
  3. group by rollup | cube 学习
  4. ★LeetCode(202)——快乐数(JavaScript)
  5. 【Vue2.0】—过滤器(七)
  6. 利息高的贷款通过率会高一些吗?
  7. 当你负债累累,看不到方向,众叛亲离时,该如何面对?
  8. 如何在麦田拍出小清新?
  9. 和女孩子约会,肢体接触是不是不礼貌?
  10. 现在为什么没有人再提“以厂为家”这样的词语啦?