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

新增

seucrity -架构-右键新增即可
在这里插入图片描述

删除

同上,选择删除即可

更改

更改架构名称:
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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值