使用 xp_cmdshell 导出 csv

发布于 2025-01-12 14:39:29 字数 332 浏览 3 评论 0原文

我正在尝试使用 xp_cmdshell 导出结果,但收到此错误:

“Sqlcmd:错误:打开或使用文件 (my_path) 时出错”

这是我在 sqlserver 上写的:

exec xp_cmdshell 'sqlcmd -S my_server -d my_db -E -Q "my_query" -s "," -o "my_path"'

我尝试过使用命令行,并且我的指令有效。

我认为这可能是一个权限问题,但我对此类事情很陌生,我无法自己解决。我希望你们中的一些人可以帮助我,谢谢

I'm trying export my results using xp_cmdshell but I recive this error :

"Sqlcmd: error: error while opening or using file (my_path)".

This is what I've wrote on sqlserver:

exec xp_cmdshell 'sqlcmd -S my_server -d my_db -E -Q "my_query" -s "," -o "my_path"'.

I've tried using command line and on it my instructions works.

I think its can be an permissions trouble but I'm new on this type of things and I can't solve by myself. I hope that some of you can help me, thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文