如何使用bcp命令导入和导出数据? [英] How can I Import and export data using bcp command?
本文介绍了如何使用bcp命令导入和导出数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用bcp工具导入和导出数据,但出现以下错误:-
I am Trying to import and export data using bcp tool but it was giving errors which are:-
SQLState = 08001, NativeError = -1
Error = [Microsoft][SQL Server Native Client 10.0]SQL Server Network Interfaces:
Error Locating Server/Instance Specified [xFFFFFFFF].
SQLState = 08001, NativeError = -1
Error = [Microsoft][SQL Server Native Client 10.0]A network-related or instance-
specific error has occurred while establishing a connection to SQL Server. Serve
r is not found or not accessible. Check if instance name is correct and if SQL S
erver is configured to allow remote connections. For more information see SQL Se
rver Books Online.
SQLState = S1T00, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Login timeout expired
我当前正在使用SQL Server 2008 r2版本.
我正在使用的命令:-
C:\Program Files\Microsoft SQL Server\100\Tools\Binn>bcp Alldbtypes.dbo.Misc_dty
pes out C:\Workarea\Data\EmployeeData.dat -S 192.168.1.117\SqlSrv2008 -T
请建议我如何使用bcp命令.
Please suggest me how can I use bcp command.
推荐答案
为了使用bpc,了解数据库的架构很重要.
In order to user the bpc, it is important to know the schema of your database.
我相信导出看起来会像这样:
I believe the Export will look something like this:
bcp "Select Column1, Column2 FROM Database.Schema.Table" queryout
C:\bcp_outputQuery.txt -SYourServerName -T -c
或者类似这样的东西:
bcp DatabaseName.Schema.TableName out C:\Data\tableout.txt -c –T
对于导入,它看起来像这样:
For the import it would look something like this:
bcp Database.Schema.Table in
C:\bcp_outputQuery.txt -SYourServername -T -c
这篇关于如何使用bcp命令导入和导出数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文