尽管架构是用户的默认架构,但仍出现无效对象错误
我在从 SSMS (SQL Server 2008) 执行选择查询时遇到问题。它给出一个错误,指出“无效对象”
User Name: admin
DefaultSchema: S1
Table being accessed: employee
Query1:
select * from employee
Query2:
select * from S1.employee
在这种情况下,Query1 因上述错误而失败,而 Query2 工作正常并获取价值观。有人可以帮我解决这里的问题吗?尽管将 S1 作为用户“admin”的默认架构,但它仍然要求我附加架构名称以执行查询。
谢谢。
I've a problem while executing a select query from SSMS (SQL Server 2008).It gives out an error saying that 'Invalid Object '
User Name: admin
DefaultSchema: S1
Table being accessed: employee
Query1:
select * from employee
Query2:
select * from S1.employee
In this case Query1 fails with above said error whereas the Query2 works fine and fetches the values. Can someone help me figure the issue here. In spite of having S1 as the default schema for the user 'admin' it still asks me to append the schema name to get the query executed.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据您的用户名是“admin”的事实,我猜测您的用户是 sysadmin 服务器角色的成员。如果是这样,则用户的默认架构设置将被忽略,因为 sysadmin 角色的所有成员都会自动获取 DBO 的默认架构。有关更多详细信息,请参阅更改用户的文档。
I'm going to guess, based on the fact that your user name is "admin", that your user is a member of the sysadmin server role. If that is true, the default schema setting for the user is ignored as all members of the sysadmin role automatically get a default schema of DBO. See the documentation for ALTER USER for further details.