在 sql 2005 express 中使用 Management Studio 导出数据但不使用 DOS 时出现 bcp 错误

发布于 2024-10-18 23:58:51 字数 275 浏览 10 评论 0原文

我正在使用 sql server 2005 Express 版本。 当我使用 dos 提示符通过 bcp 实用程序导出数据时,没有错误, 但是当我为导出过程创建存储过程并使用 Management Studio Express 导出数据时,它会出现以下错误:

SQLState = S1000,NativeError = 0 错误 = [Microsoft][SQL Server Native Client 10.0]无法打开 BCP 主机数据文件

请提供帮助。

i am using sql server 2005 express edition .
when i export data via bcp utility using dos prompt then there is no error ,
but when i created a stored procedure for the export process and use management studio express for exporting data then it gives the following error :

SQLState = S1000, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Unable to open BCP host data-file

Please help.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冬天旳寂寞 2024-10-25 23:58:51

我也有同样的问题,但答案是我不够聪明。

由于该命令是在服务器上运行,而不是在我的本地计算机上运行,​​因此它试图写入服务器上不存在的文件夹。它对 C: 的根目录成功执行,但对我的共享文件夹 C:\share 执行失败。对我来说,问题是我正在 C 盘根目录中查找该文件,而不是服务器。

当我将路径更改为 \mymachinename\share 时,一切正常。

I had the same issue, but the answer is that I was being less than bright.

As the command was being run on a server, not my local machine, it was trying to write to a non-existent folder on the server. It was executing successfully against the root of C: but not against my share folder, C:\share. The problem for me was that I was looking for the file in the root of my C Drive, not the servers.

When I changed the path to \mymachinename\share, everything worked.

若无相欠,怎会相见 2024-10-25 23:58:51

当您使用 DOS 命令行运行 bcp 实用程序时,您将使用登录人员凭据(通常是您自己的凭据),但是当作为存储过程运行时,您将使用 SQL Server 进程的凭据,通常将其配置为比普通用户少得多的权限,以提供针对各种攻击的安全性。

检查用于 SQL Server 数据库引擎的用户的服务列表,并检查该用户是否对所涉及的目录和文件有足够的读/写权限。

When you run the bcp utility using the DOS command line you are using the logged in persons credentials (usually your own), but when running as a stored procedure you are using the credentials of the SQL server process, which usually is configured to have much less permissions than ordinary users in order to provide safety against various attacks.

Check in the Services list of which user is used for the SQL server database engine and check if that user has enough read/write permissions to the directories and files involved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文