最近学了SQL Server 2005,那个架构级别权限有点糊涂。

解决方案 »

  1.   

    数据库架构可以看作数据库对象的容器,是独立于数据库用户帐户的名称空间-每个数据库对象都要属于一个数据库架构。架构也是安全对象-架构下的安全对象会继承架构上设置的权限。-- create sample data
    create user test without login
    go
    create user test1 without login;
    go
    create schema test authorization test
    go
    alter user test with default_schema=test
    go
    create table test.tab (id int);
    go-- test
    grant select on schema::test to test1
    go
    execute as user='test1'
    select * from test.tab
    revert
    go
    revoke select on schema::test to test1
    go-- clean
    drop table test.tab;
    go
    drop schema test;
    go
    drop user test;
    go
    drop user test1;
    go
      

  2.   

    架构权限:
    你可以在某个架构权限中 添加"用户或角色"然后针对添加的"用户或角色",分别为他们指点能对此架构包含的对象(如表)具有何种权限,
    譬如读权限 写权限.譬如说有一个架构sc1,  sc1是一个容器,其中的表对象有table1 ,table2
    在权限中添加了一个用户U1
    你可以设置用户u1对架构sc1所包含的表table1 ,table2执行哪种操作.