sql-server – TSQL授予对所有表的读写权限

前端之家收集整理的这篇文章主要介绍了sql-server – TSQL授予对所有表的读写权限前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
是设置
EXEC sp_addrolemember N'db_datareader',N'User'
EXEC sp_addrolemember N'db_datawriter',N'User'

与将所有表上的SELECT / INSERT / DELETE / UPDATE授予“用户”相同

GRANT SELECT ON  [Schema].[Table] TO [User]
GRANT INSERT ON  [Schema].[Table] TO [User]
GRANT DELETE ON  [Schema].[Table] TO [User]
GRANT UPDATE ON  [Schema].[Table] TO [User]

解决方法

从MSDN( db_datawriter,db_datareader):

Members of the db_datawriter fixed database role can add,delete,or change data in all user tables.

Members of the db_datareader fixed database role can run a SELECT statement against any table or view in the database.

所以,效果是一样的,只是在第一种情况下更容易管理.

原文链接:https://www.f2er.com/mssql/75464.html

猜你在找的MsSQL相关文章