简体   繁体   English

如何快速检查用户是否具有对SQL Server中特定数据库的写访问权限?

[英]How to check quickly whether the user has write access to a particular db in sql server or not?

I have a requirement where in, I have to check whether the user has write access to a particular sql server or not. 我有一个要求,我必须检查用户是否具有对特定sql服务器的写权限。

I have done this with using Dir function for access db and other files 我通过使用Dir function for access db and other files来完成此Dir function for access db and other files

But SQL server, do I have to try and write a value to a table to see whether it allows me or not ? 但是,SQL Server是否必须尝试向表中写入一个值以查看它是否允许我?

You could try: fn_my_permissions . 您可以尝试: fn_my_permissions The following is based on an example from the web page. 以下基于网页中的示例。

SELECT * FROM fn_my_permissions('dbo.MyTable', 'OBJECT')   
    ORDER BY subentity_name, permission_name ;

This will return three columns: 这将返回三列:

  • entity_name (table in this case), 实体名称(在这种情况下为表格),
  • subentity_name (column in this table), subentity_name(此表中的列),
  • and permission_name (ALTER, SELECT, etc.). 和权限名(ALTER,SELECT等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何查看用户是否有过往记录? - How to check whether a user has records in past? 如何检查SQL Server 2012的IF-ELSE控制语句中是否已成功执行SQL查询? - How to check whether a SQL query has executed successfully in a IF-ELSE Control Statement in SQL Server 2012? 使用 powershell 检查用户对 sql 服务器中 Db 的访问权限 - Check the user access to a Db in sql serverusing powershell 如何获取特定用户有权访问的所有表-DB2 - How to get all the tables on which a particular user has access-DB2 如何检查特定字符串是否在SQL数据库中存储的一系列字符串中 - how to check whether a particular string is in a series of string stored in SQL database 如何使用GRANT OPTION检查用户是否具有权限? - How to check whether a user has permission WITH GRANT OPTION? 如何检查当前用户是否已经喜欢或不喜欢该评论 - How to check Whether the Current User has Already Like or Dislike the comment 如何快速判断表是否多于N行? - How to determine whether table has more than N rows quickly? SQL Server 中如何检查两个选择的结果是否相等? - How to check whether results of two selects are equal in SQL Server? Drupal 7-如何检查特定字段是否具有值-SQL查询? - Drupal 7 - How to check if a particular field has a value - sql query?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM