基于角色的权限访问控制数据库设计- cychai的专栏- CSDN博客(2)

2019-05-24 19:25

'FK_USERROLE_FK_ROLE_R_ROLE') alter table userRole

drop constraint FK_USERROLE_FK_ROLE_R_ROLE go

if exists (select 1

from sys.sysreferences r join sys.sysobjects o on (o.id = r.constid and o.type = 'F')

where r.fkeyid = object_id('userRole') and o.name = 'FK_USERROLE_FK_USER_I_USER') alter table userRole

drop constraint FK_USERROLE_FK_USER_I_USER go

if exists (select 1

from sysobjects

where id = object_id('Permission') and type = 'U') drop table Permission go

if exists (select 1

from sysobjects

where id = object_id('RolePermission') and type = 'U')

drop table RolePermission go

if exists (select 1

from sysobjects

where id = object_id('customer') and type = 'U') drop table customer go

if exists (select 1

from sysobjects

where id = object_id('employee') and type = 'U') drop table employee go

if exists (select 1

from sysobjects

where id = object_id('guest') and type = 'U') drop table guest go

if exists (select 1

from sysobjects

where id = object_id('role') and type = 'U') drop table role go

if exists (select 1

from sysobjects

where id = object_id('\ and type = 'U') drop table \go

if exists (select 1

from sysobjects

where id = object_id('userRole') and type = 'U') drop table userRole go

/*==============================================================*/

/* Table: Permission */

/*==============================================================*/

create table Permission (

ID int not null, Name nvarchar(64) null, constraint PK_PERMISSION primary key (ID) ) go

declare @CurrentUser sysname select @CurrentUser = user_name()

execute sp_addextendedproperty 'MS_Description', '权限',

'user', @CurrentUser, 'table', 'Permission' go

/*==============================================================*/

/* Table: RolePermission */

/*==============================================================*/ create table RolePermission (

roleID int not null, permissionID int not null, constraint PK_ROLEPERMISSION primary key (roleID,

permissionID) ) go

declare @CurrentUser sysname select @CurrentUser = user_name()

execute sp_addextendedproperty 'MS_Description', '授权',

'user', @CurrentUser, 'table', 'RolePermission' go

/*==============================================================*/

/* Table: customer */

/*==============================================================*/ create table customer (

customerID int not null, customerName varchar(64) null, companyName varchar(64) null, oder varchar(64) null, constraint PK_CUSTOMER primary key (customerID) )


基于角色的权限访问控制数据库设计- cychai的专栏- CSDN博客(2).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:开发区机器人及智能装备产业调研报告

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: