找不到存储过程
我们使用 SQL Server 2008 作为 RDBMS,并且我们的数据库拥有不同的用户而不是 dbo 作为其所有者。
问题是在一台计算机上,除非提及其所有者,否则存储过程无法运行。
如果我们使用此用户连接到我们的数据库并尝试执行以下操作:
exec ourSP
我们收到“无法找到我们的SP”错误,但这工作正常:
exec user.ourSP
有人知道什么会导致这种奇怪的行为吗?
We use SQL server 2008 as our RDBMS and we have a database that has a different user rather than dbo as its owner.
The problem is in one machine a stored procedure can not run unless its owner is mentioned.
If we connect to our database using this user and try to execute the following :
exec ourSP
we get a "could not find ourSP" error but this works fine:
exec user.ourSP
Does anybody knows what can lead to such a strange behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查正在建立连接的用户的默认架构 - 可能使用查询
在用户的默认架构中搜索对象,然后在 dbo 中搜索。除非您像在第二个查询中那样明确命名,否则不会考虑其他模式。
在此基础上,可能是 a) 用户设置不正确或 b) 您没有按照您期望的用户方式进行连接。
Check the default schema of the user under which the connection is being made - possibly using the query
Objects are searched for in the user's default schema and then dbo. No other schemas are considered unless you name them explicitly, as you do in your second query.
On this basis, it seems likely that a) the user isn't set up correctly or b) you're not connecting as the user you expect.
看起来,如果用户在服务器安全区域中被检查为 SysAdmin,则在建立与数据库的连接时它将具有 dbo 用户名,并且它将被视为 dbo。
It seems that If a user is checked as SysAdmin in sever security area it will have the dbo user name when a connection to a database is made and it will be treated like dbo.