如何检查特定用户对特定数据库的读写权限 [英] How to check the read and write permissions on specific database by specific users

查看:97
本文介绍了如何检查特定用户对特定数据库的读写权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我需要在etl工具上的存储库上创建。为此,我必须检查数据库对用户sa的权限(读写访问权限)我尝试了以下代码: -



我的尝试:



Hi All
I need to create on repository on an etl tool.For that i got to review the permissions over the database for the user sa(read and write access) I tried the following codes:-

What I have tried:

SELECT DATABASEPROPERTYEX('TestProfiler', 'Updateability')





操作:READ_WRITE





Op: READ_WRITE

SELECT name, is_read_only
FROM sys.databases
WHERE name = 'TestProfiler'
GO





名称IsReadOnly

Op TestProfiler 0





Name IsReadOnly
Op TestProfiler 0

SELECT u.name, o.name
FROM syspermissions p, sysobjects o, sysusers u
WHERE p.id = o.id
AND u.uid = p.grantee
AND u.name IN ('sa')
AND o.xtype = 'U'
AND p.actadd = 27





op:姓名名称

空白

从第一个查询中清楚表格有读/写访问权限,但无论是否为sa用户我都不知道:(请提供解决方案,或者另外一种方法来查看读写权限访问权限(我的登录凭据涉及用户sa)

谢谢

问候

推荐答案

这并不像你想象的那么容易!



首先 - 避免使用syspermissions表 - 改为使用sys视图。在SQL的更高版本中将删除syspermissions



此链接上有一个非常流行的解决方案(Jeremy解决方案) SQL Server查询以查找所有用户的所有权限/访问权限数据库 [ ^ ],它为数据库中的所有对象提供查询 - 您应该能够根据需要进行调整
It's not as easy as you think it should be!

Firstly - avoid using the syspermissions table - use the sys views instead. syspermissions will be removed in later versions of SQL

There is a very popular solution on this link (solution by "Jeremy") SQL Server query to find all permissions/access for all users in a database[^] which gives a query for all objects in the database - you should be able to adapt it to your needs


这篇关于如何检查特定用户对特定数据库的读写权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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