EXEC sp_addrolemember N'db_owner', N'db'----將db 設置為 db_owner 角色中的一員EXEC sp_droprolemember N'db_owner', N'db'----將db 從 db_owner 角色 去除 ALTER AUTHORIZATI...
EXEC sp_addrolemember N'db_owner', N'db'----將db 設置為 db_owner 角色中的一員
EXEC sp_droprolemember N'db_owner', N'db'----將db 從 db_owner 角色 去除
ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO dbs ----給db 賦予 擁有 db_datareader 架構
ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO db --- 修改 db_datareader 架構的所有者為db
ALTER AUTHORIZATION ON SCHEMA::[db_ddladmin] TO [db_datareader] ---修改 db_datareader 角色所擁有的架構
--- 賦予 《授予 XX 許可權》
GRANT VIEW DEFINITION ON [dbo].[PSYP_DataBaseBackUp] TO [db] --查看
GRANT ALTER ON [dbo].[PSYP_DataBaseBackUp] TO [db] --修改
GRANT TAKE OWNERSHIP ON [dbo].[PSYP_DataBaseBackUp] TO [db] --接管所有權
GRANT CONTROL ON [dbo].[PSYP_DataBaseBackUp] TO [db] --控制權
GRANT EXECUTE ON dbo.[PSYP_DataBaseBackUp] TO db --執行
---賦予 《具有授予XX許可權》
---如果直接給 具有授予許可權 則 預設給予了XX許可權
GRANT VIEW DEFINITION ON [dbo].[PSYP_DataBaseBackUp] TO [db] WITH GRANT OPTION --- --查看許可權並具有授予許可權
GRANT ALTER ON [dbo].[PSYP_DataBaseBackUp] TO [db] WITH GRANT OPTION
GRANT TAKE OWNERSHIP ON [dbo].[PSYP_DataBaseBackUp] TO [db] WITH GRANT OPTION
GRANT CONTROL ON [dbo].[PSYP_DataBaseBackUp] TO [db] WITH GRANT OPTION
GRANT EXECUTE ON [dbo].[PSYP_DataBaseBackUp] TO [db] WITH GRANT OPTION
----拒絕XX許可權
DENY VIEW DEFINITION ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
DENY ALTER ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
DENY TAKE OWNERSHIP ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
DENY CONTROL ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
DENY EXECUTE ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
---收回XX許可權
REVOKE VIEW DEFINITION ON [dbo].[PSYP_DataBaseBackUp] TO [db] ---查看定義
REVOKE ALTER ON [dbo].[PSYP_DataBaseBackUp] TO [db] --修改
REVOKE TAKE OWNERSHIP ON [dbo].[PSYP_DataBaseBackUp] TO [db] --接管所有權
REVOKE CONTROL ON [dbo].[PSYP_DataBaseBackUp] TO [db] --控制權
REVOKE EXECUTE ON dbo.[PSYP_DataBaseBackUp] TO db --執行
---收回XX具有授予許可權
REVOKE GRANT OPTION FOR VIEW DEFINITION ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
REVOKE GRANT OPTION FOR ALTER ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
REVOKE GRANT OPTION FOR TAKE OWNERSHIP ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
REVOKE GRANT OPTION FOR CONTROL ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
REVOKE GRANT OPTION FOR EXECUTE ON [dbo].[PSYP_DataBaseBackUp] TO [db] CASCADE
--------給表賦 許可權
--- 賦予 《具有授予XX許可權》
GRANT INSERT ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT VIEW DEFINITION ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT VIEW CHANGE TRACKING ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT ALTER ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT UPDATE ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT TAKE OWNERSHIP ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT CONTROL ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT DELETE ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT SELECT ON [dbo].[a] TO [db] WITH GRANT OPTION
GRANT REFERENCES ON [dbo].[a] TO [db] WITH GRANT OPTION
----------表 和 視圖 具有相同的許可權
INSERT --插入
VIEW DEFINITION --查看定義
VIEW CHANGE TRACKING -- 查看更改跟蹤
ALTER ---修改
UPDATE ---更新
TAKE OWNERSHIP ---接管所有權
CONTROL ---控制
DELETE ---刪除
Select ---選擇
REFERENCES --引用
----存儲過程 具有的許可權
VIEW DEFINITION ---查看
ALTER ---修改
TAKE OWNERSHIP ---接管所有權
CONTROL ---控制
EXECUTE ---執行
-----標量函數 的許可權
VIEW DEFINITION ---查看定義
ALTER ---修改
TAKE OWNERSHIP ---接管所有權
CONTROL ---控制
REFERENCES ---引用
EXECUTE ---執行
------表值函數 的許可權
VIEW DEFINITION ---查看定義
ALTER ---修改
TAKE OWNERSHIP --接管所有權
CONTROL ---控制
REFERENCES ---引用
SELECT ---選擇