是设置
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.
所以,效果是一样的,只是在第一种情况下更容易管理.