当前数据库中 SQL Server 角色的名称。role 的数据类型为 sysname,没有默认值。
[@membername =] 'security_account'
添加到角色的安全帐户。security_account 的数据类型为 sysname,没有默认值。security_account 可以是所有有效的 SQL Server 用户、SQL Server 角色或是所有已授权访问当前数据库的 Microsoft Windows NT® 用户或组。当添加 Windows NT 用户或组时,请指定在数据库中用来识别该 Windows NT 用户或组的名称(使用 sp_grantdbaccess 添加)。
--Create a login account for the 'test' user
execute sp_addlogin 'test','1234','Northwind',null
go
--Create a group
execute sp_addgroup 'testgroup'
go
--Add the test user to Database
execute sp_adduser 'test','test','testgroup'
go
grant update,insert
on customers -- YOU CAN DEFINED WHICH TABLE YOU WANT GRANT TO TEST USER
to testgroup