bcp导入到数据库
介绍 ( Introduction )
Sometimes, we need to use the command line to copy tables using the command line. In this new chapter, we will use the BCP command to copy tables from a local machine to the SQL Server in Azure. The BCP is a very fast bulk copy tools used for this purpose.
有时,我们需要使用命令行来使用命令行复制表。 在这一新的章节中,我们将使用BCP命令将表从本地计算机复制到Azure中SQL Server。 BCP是用于此目的的非常快速的批量复制工具。
We will also learn how to create a Linked Server in our local machine to Azure. The Linked Servers are very powerful features of SQL Server to connect SQL Server to different Data Sources like Excel, MS Access, Oracle, MySQL, and several databases. In this example, we will connect to SQL Azure.
我们还将学习如何在本地计算机上创建到Azure的链接服务器。 链接服务器是SQL Server的非常强大的功能,可以将SQL Server连接到不同的数据源,例如Excel,MS Access,Oracle,MySQL和多个数据库。 在此示例中,我们将连接到SQL Azure。
要求 ( Requirements )
- An Azure subscription. Azure订阅。
- my article about Azure VMs).参阅有关Azure VM的文章 )。
- The AdventureWorks database installed in the source and destination columns (you can create your own tables if you prefer). 在源列和目标列中安装了AdventureWorks数据库(如果愿意,可以创建自己的表)。
- A local machine with Windows installed. 安装Windows的本地计算机。
- our article related here).此处的相关文章 )。
入门 ( Getting started )
In order to start, in the local machine open the command prompt.
为了启动,在本地计算机上打开命令提示符。
Figure 1. The cmd
图1. cmdIn the command prompt, run the following bcp command:
在命令提示符下,运行以下bcp命令:
bcp adventureworks2014.humanresources.department out c:\s
cripts\department.dat -S localhost -T -n –qbcp adventureworks2014.humanresources.department out c:\ s
cripts \ department.dat -S本地主机-T -n –q- The command copies the data of the table HumanResources.Department of the Adventureworks2014 database to the file department.dat. The –S parameter is the Server name, the –T me