在 SQL Server 中查询 master..syslogins 需要什么权限? [英] What permissions are required to query master..syslogins in SQL Server?

查看:45
本文介绍了在 SQL Server 中查询 master..syslogins 需要什么权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 master 数据库具有只读访问权限,但是以下查询仅返回用户的子集.返回其余用户需要什么权限?

I have readonly access to the master database however the following query only returns a subset of users. What permissions are needed to return the rest of the users?

SELECT [name] FROM master.dbo.syslogins

推荐答案

您使用的是哪个版本的 SQL Server?

What version of SQL Server are you on??

syslogins 目录视图已被 SQL Server 2005 弃用 - 如果您使用的是 2005 或更高版本,则应使用 sys.server_principalssys.sql_logins 代替.

The syslogins catalog view has been deprecated with SQL Server 2005 - if you're on 2005 or up, you should use sys.server_principals and sys.sql_logins instead.

当您查看 MSDN Books Online 主题 以了解 sys.server_principals,您会在页面底部看到一条注释:

When you check the MSDN Books Online topic for sys.server_principals, you'll see a note at the bottom of the page:

在 SQL Server 2005 及更高版本中,元数据的可见性目录视图仅限于安全对象用户拥有或在其上用户已被授予一些允许.有关更多信息,请参阅元数据可见性配置.

In SQL Server 2005 and later versions, the visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.

转到元数据可见性配置页面阅读您将能够看到哪些对象以及如何访问其他对象的详细信息.

Go to the Metadata Visibility Configuration page to read up on the details of what objects you will be able to see, and how to get access to others.

如果您想授予权限,此注释是最重要的部分:

This note is the most important part if you want to grant permissions:

要允许呼叫者查看元数据,您可以授予调用者 VIEW定义权限适当的范围:对象级别,数据库级别或服务器级别.因此,在前面的例子中,如果调用者有 VIEW DEFINITION对 myTable 的权限,存储的过程返回一行.

To allow callers to view metadata, you can grant the callers VIEW DEFINITION permission at an appropriate scope: object level, database level or server level. Therefore, in the previous example, if the caller has VIEW DEFINITION permission on myTable, the stored procedure returns a row.

这篇关于在 SQL Server 中查询 master..syslogins 需要什么权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆