Sqlserver 结构之架构篇(壹) 架构增删改查

新增

seucrity -架构-右键新增即可
Sqlserver 结构之架构篇(壹) 架构增删改查_第1张图片

删除

同上,选择删除即可

更改

更改架构名称:
ALTER SCHEMA 新构架名 TRANSFER 旧构架名.A000001

更改所属架构:
alter schema 新架构名transfer 旧架构名.表名;

查询

#查询表架构:
https://blog.csdn.net/Ca_va/article/details/106495319

T-SQL

--声明数据库引用
use database_name;
go
 
修改用户或者角色
alter authorization on schema::[ArchitectureName] to [schemaOwner];
go
 
--修改用户或角色权限
--授予插入
grant insert on schema::[ArchitectureName] to [rolename_username];
go
 
--授予查看定义
grant view definition on schema::[ArchitectureName] to [rolename_username];
go
 
--授予查看更改跟踪
grant view change tracking on schema::[ArchitectureName] to [rolename_username];
go
 
--授予创建序列
grant create sequence on schema::[ArchitectureName] to [rolename_username];
go
 
--授予更改
grant alter on schema::[ArchitectureName] to [rolename_username];
go
  
 --授予更新
grant update on schema::[ArchitectureName] to [rolename_username];
go
 
--接管所有权
grant take ownership on schema::[ArchitectureName] to [rolename_username];
go
 
--授予控制
grant control on schema::[ArchitectureName] to [rolename_username];
go
 
--授予删除
grant delete on schema::[ArchitectureName] to [rolename_username];
go
 
--授予选择
grant select on schema::[ArchitectureName] to [rolename_username];
go
 
--授予引用
grant references on schema::[ArchitectureName] to [rolename_username];
go
 
--授予执行
grant execute on schema::[ArchitectureName] to [rolename_username];
go
 
--授予并允许转授插入
grant insert on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授查看定义
grant view definition on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授查看更改跟踪
grant view change tracking on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授创建序列
grant create sequence on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授更改
grant alter on schema::[ArchitectureName] to [rolename_username] with grant option;
go
  
 --授予并允许转授更新
grant update on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--接管并允许转授所有权
grant take ownership on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授控制
grant control on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授删除
grant delete on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授选择
grant select on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授引用
grant references on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--授予并允许转授执行
grant execute on schema::[ArchitectureName] to [rolename_username] with grant option;
go
 
--拒绝插入
deny insert on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝查看定义
deny view definition on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝查看更改跟踪
deny view change tracking on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝创建序列
deny create sequence on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝更改
deny alter on schema::[ArchitectureName] to [rolename_username];
go
  
--拒绝更新
deny update on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝所有权
deny take ownership on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝控制
deny control on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝删除
deny delete on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝选择
deny select on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝引用
deny references on schema::[ArchitectureName] to [rolename_username];
go
 
--拒绝执行
deny execute on schema::[ArchitectureName] to [rolename_username];
go
 
删除数据库架构扩展属性
exec sys.sp_dropextendedproperty @name=N'extendedAttributeName',@level0type=N'schema',@level0name=N'extendedAttributeValue'
go
 
创建数据库架构扩属性
exec sys.sp_addextendedproperty @name=N'newExtendedAttributeName',@value=N'newExtendedAttributeValue' , @level0type=N'schema',@level0name=N'ArchitectureName'
go
 
--修改数据库架构
alter schema schema_name(你要修改成得新架构)
transfer { object | type | xml schema collection } securable_name (原架构名.对象名);
go

你可能感兴趣的:(Sqlserver)