我可以使用bcp指定输入sql文件吗? [英] Can I specify an input sql file with bcp?

查看:150
本文介绍了我可以使用bcp指定输入sql文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用bcp时,如何通过长查询指定输入sql文件?我尝试使用-i选项,但它一直抱怨没有任何其他信息的命令行错误.这可能吗?

How can I specify an input sql file with a long query when using bcp? I tried using the -i option but it keeps complaining about a command-line error with no extra information. Is this possible?

推荐答案

就我而言,BCP实用程序仅支持直接写入命令行的Transact-SQL查询.例如:

As far as I'm concerned the BCP utility only supports Transact-SQL queries directly written to the command line. Ex:

bcp从AdventureWorks.Sales.Currency中选择名称"查询出Currency.Name.dat -T -c

bcp "SELECT Name FROM AdventureWorks.Sales.Currency" queryout Currency.Name.dat -T -c

根据其引用"-i"选项:

指定响应文件的名称,其中包含使用交互方式(未指定-n,-c,-w或-N)执行批量复制时每个数据字段对命令提示符问题的响应.

Specifies the name of a response file, containing the responses to the command prompt questions for each data field when a bulk copy is being performed using interactive mode (-n, -c, -w, or -N not specified).

请注意,它与 sqlcmd实用工具"-i"不同选项:

Notice that it differs from the sqlcmd Utility "-i" option:

标识包含一批SQL语句或存储过程的文件.可以指定多个文件,这些文件将按顺序(...)进行读取和处理

Identifies the file that contains a batch of SQL statements or stored procedures. Multiple files may be specified that will be read and processed in order (...)

这篇关于我可以使用bcp指定输入sql文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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