使用 UNC 路径时出现访问被拒绝错误
我正在使用 SQL Server 2008,并且在尝试执行访问网络路径的 BULK INSERT
时收到“访问被拒绝”错误,格式为:\\network_ip_address\Localdiskname$\filename_with_extenstion
。
BULK
INSERT TableName
FROM '\\10.1.10.100\d$\Temp.csv'
我应该如何正确编写查询?如何在查询中指定网络身份验证凭据(例如用户名和密码)?
I am using SQL Server 2008 and I am getting an Access Denied error while trying to do a BULK INSERT
which is accessing a network path, in the form: \\network_ip_address\Localdiskname$\filename_with_extenstion
.
BULK
INSERT TableName
FROM '\\10.1.10.100\d$\Temp.csv'
How should I write the query correctly? How do I specify network authentication credentials such as username and password in the query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有几件事 -
实际运行批量插入命令可能存在权限问题。确保您运行批量插入操作的帐户具有bulkadmin 固定服务器角色,或授予允许执行批量插入操作的管理批量操作权限。
同样对于 UNC 路径 - 您无法在查询中指定网络身份验证凭据。这将作为运行 SQL 的服务帐户访问该路径。
我将验证:
SQL Server 在线书籍中的这篇文章告诉您需要了解的所有信息批量操作,并包含有关权限和网络安全的部分。
A couple things here -
There may be a permissions issue on actually running the bulk insert command. Make sure that the account you are running the bulk insert operation from has the Fixed Server Role of bulkadmin or grant Administer Bulk Operations permissions which allows bulk insert operations to happen.
Also for the UNC path - You can't specify network authentication credentials in the query. This is going to access that path as the service account that SQL is running under.
I would verify:
This article in SQL Server books online tells you all you need to know about bulk operations and has sections on permissions and network security.