用户可以属于多个角色,从多个角色同时继承权限。
也就是说一个用户可以同时属于数据库的PUBLIC角色,同时可以属于
SA和SecurityAdmin角色。权限可以授予某个特定用户也可以授予角色,用户通过继承角色的权限取得权利。
你可以通过Revoke从角色收回权限,但不妨碍用户从其它角色继承权利。

解决方案 »

  1.   

    --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
      

  2.   

    EXEC master..sp_addlogin '用户', '密码', '他的库',null
    go
    use 他的库
    EXEC sp_adduser '用户'