当前位置: 代码迷 >> Sql Server >> bcp的语法异常
  详细解决方案

bcp的语法异常

热度:63   发布时间:2016-04-27 21:19:48.0
bcp的语法错误
exec   master..xp_cmdshell   bcp   "select   *   from   ceshi.dbo.xueall "   queryout   xueall.txt   -c   -SBIGONEW\SQLEXPRESS   -UBIGONEW)
提示说语法错误,请教!


------解决方案--------------------
exec master..xp_cmdshell 'bcp "select * from 数据库名..表名 " queryout d:\aa.txt -c -S服务器名 -Usa -P密码 '
------解决方案--------------------
EXEC master..xp_cmdshell 'bcp 数据库名.dbo.表名 out "c:\test.xls " /c -/S "服务器名 " /U "用户名 " -P "密码 " '

------解决方案--------------------
--导出查询的情况
EXEC master..xp_cmdshell 'bcp "SELECT au_fname, au_lname FROM pubs..authors ORDER BY au_lname " queryout "c:\test.xls " /c -/S "服务器名 " /U "用户名 " -P "密码 " '
  相关解决方案