bcp怎么用啊?

xiphias 2003-08-19 04:58:21
我再查询分析器里面执行时出错
bcp "select * from mydb..tempdb" queryout "temp.txt"

服务器: 消息 170,级别 15,状态 1,行 1
第 1 行: 'queryout' 附近有语法错误。
...全文
94 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
smallroad 2003-08-19
  • 打赏
  • 举报
回复
exec master..xp_cmdshell 'bcp mydb..tempdb yout c:\temp.txt -c -S -U -P'
CrazyFor 2003-08-19
  • 打赏
  • 举报
回复
exec master..xp_cmdshell 'bcp "select * from mydb..tempdb" queryout "temp.txt" -c .....'

--------------

例如,Northwind 数据库内有表 Jane's Orders,该表由用户 Jane Doe 所拥有。若要使用登录 Jane Doe 和密码 go dba 将该表从 Northwind 数据库大容量复制到 Orders.txt 文件,请执行下列命令之一:

bcp "Northwind.Jane Doe.Jane's Orders" out "Jane's Orders.txt" -c -q -U"Jane Doe" -P"go dba"

bcp "Northwind.[Jane Doe].[Jane's Orders]" out "Jane's Orders.txt" -c -U"Jane Doe" -P"go dba"

若要指定包含空格或引号的数据库名称,必须使用 -q 选项。

有关此实用工具位置和运行方式的信息,请参见命令提示实用工具入门。

pengdali 2003-08-19
  • 打赏
  • 举报
回复
EXEC master..xp_cmdshell 'bcp test.dbo.P_Aspect in c:\temp1.txt -c -q -S"servername" -U"sa" -P""'
//导入

EXEC master..xp_cmdshell 'bcp test.dbo.P_Aspect out c:\temp1.txt -c -q -S"servername" -U"sa" -P""'
//导出
xiphias 2003-08-19
  • 打赏
  • 举报
回复
up

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧