sql server2005如何查询一个登录名的权限。
时间:2011-12-13
来源:互联网
使用sa登录sql server2005,怎样查询一个登录名有哪些读写权限以及能够操作哪些表?
作者: speedk8 发布时间: 2011-12-13
sp_helprotect
作者: Beirut 发布时间: 2011-12-13
-- 查询当前数据库用户账户的权限
select object_name(id) obj,
(case [action] when 26 then 'REFERENCES'
when 178 then 'CREATE FUNCTION'
when 193 then 'SELECT'
when 195 then 'INSERT'
when 196 then 'DELETE'
when 197 then 'UPDATE'
when 198 then 'CREATE TABLE'
when 203 then 'CREATE DATABASE'
when 207 then 'CREATE VIEW'
when 222 then 'CREATE PROCEDURE'
when 224 then 'EXECUTE'
when 228 then 'BACKUP DATABASE'
when 233 then 'CREATE DEFAULT'
when 235 then 'BACKUP LOG'
when 236 then 'CREATE RULE' end) perm
from sysprotects where [uid]=user_id()
select object_name(id) obj,
(case [action] when 26 then 'REFERENCES'
when 178 then 'CREATE FUNCTION'
when 193 then 'SELECT'
when 195 then 'INSERT'
when 196 then 'DELETE'
when 197 then 'UPDATE'
when 198 then 'CREATE TABLE'
when 203 then 'CREATE DATABASE'
when 207 then 'CREATE VIEW'
when 222 then 'CREATE PROCEDURE'
when 224 then 'EXECUTE'
when 228 then 'BACKUP DATABASE'
when 233 then 'CREATE DEFAULT'
when 235 then 'BACKUP LOG'
when 236 then 'CREATE RULE' end) perm
from sysprotects where [uid]=user_id()
作者: dawugui 发布时间: 2011-12-13
SQL code
--sql 2000 -- 查询当前数据库用户账户的权限 select object_name(id) obj, (case [action] when 26 then 'REFERENCES' when 178 then 'CREATE FUNCTION' when 193 then 'SELECT' when 195 then 'INSERT' when 196 then 'DELETE' when 197 then 'UPDATE' when 198 then 'CREATE TABLE' when 203 then 'CREATE DATABASE' when 207 then 'CREATE VIEW' when 222 then 'CREATE PROCEDURE' when 224 then 'EXECUTE' when 228 then 'BACKUP DATABASE' when 233 then 'CREATE DEFAULT' when 235 then 'BACKUP LOG' when 236 then 'CREATE RULE' end) perm from sysprotects where [uid]=user_id() --sql 2005 EXECUTE AS LOGIN = 'sa'; SELECT * FROM fn_my_permissions(NULL, 'DATABASE'); REVERT;
作者: dawugui 发布时间: 2011-12-13
引用 3 楼 dawugui 的回复:
SQL code
--sql 2000
-- 查询当前数据库用户账户的权限
select object_name(id) obj,
(case [action] when 26 then 'REFERENCES'
when 178 then 'CREATE FUNCTION'
when 193 then 'SELECT'
when 195 then 'INSERT'
whe……
SQL code
--sql 2000
-- 查询当前数据库用户账户的权限
select object_name(id) obj,
(case [action] when 26 then 'REFERENCES'
when 178 then 'CREATE FUNCTION'
when 193 then 'SELECT'
when 195 then 'INSERT'
whe……
+1
作者: liuqian4243 发布时间: 2011-12-13
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28