自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

創(chuàng)建SQL角色與權(quán)限用到的五個數(shù)據(jù)庫表

數(shù)據(jù)庫 SQL Server
SQL角色創(chuàng)建以及授權(quán)的時候,需要用到一些表,下面就為您介紹這些表的創(chuàng)建腳本,供您參考學(xué)習(xí)。

下文為您列舉的五張表是在創(chuàng)建SQL角色與權(quán)限時需要用到的,如果您在創(chuàng)建SQL角色等方面遇到過問題,不妨一看,對您會有所啟迪。

創(chuàng)建SQL角色與權(quán)限要用到五張數(shù)據(jù)庫表:
1,SQL用戶信息表

  1. create table employee  
  2. (  
  3.    userid varchar(50) not null,  --用戶ID  
  4.    username varchar(100),    --用戶名  
  5.    userpassword varchar(100), --密碼  
  6.    ..  
  7.    ..  
  8.    ..  
  9.    ..  
  10. )  
  11. alter table employee        --主鍵  
  12. add constraint pk_employee_userid primary key (userid) 

2,SQL角色表

  1. create table role  
  2. (  
  3.   roleid varchar(50) not null, --角色Id  
  4.   rolename varchar(100),        --角色名稱  
  5. )  
  6. alter table tole     --主鍵  
  7. add constraint pk_role_roleid primary key (roleid) 

3,SQL權(quán)限表

  1. create table popedom  
  2. (  
  3.   popedomid int identity(1,1) not null, --權(quán)限Id  
  4.   popedomname varchar(100), --權(quán)限名稱  
  5.   popedomfatherid int,      --權(quán)限父ID  
  6.   popedomurl varchar(100)   --樹的連接路徑  
  7.   ..  
  8.   ..  
  9. )  
  10. er table popedom       --主鍵  
  11. add constraint PK_popedom primary key (popedomid)   

添加數(shù)據(jù)如
insert into popedom values('我的辦公桌',0,'')
insert into popedom values('電子郵箱',1,'../mail/EmaiolManage.aspx')
(添加數(shù)據(jù)的原則是一級接點的popedomfatherid 為0,如果是(我的辦公桌)下面的接點,它們的popedomfatherid為(我的辦公桌)的主鍵)

4,用戶與角色關(guān)系表

  1. create table user_role  
  2. (  
  3.  connectionid int identity(1,1) not null, --關(guān)系ID  
  4.   userid varchar(50) not null,   --管理員表ID  
  5.   roleid varchar(50) not null   --角色Id  
  6. )  
  7. alter table user_role    --主鍵  
  8. add constraint PK_admin_role primary key(connectionid)   

5,角色與權(quán)限關(guān)系表

  1. create table role_popedom     --角色與權(quán)限表  
  2. (  
  3.   connectionid int identity(1,1), --關(guān)系Id  
  4.   roleid varchar(50) not null,      --角色ID  
  5.   popedomid int not null,   --權(quán)限Id  
  6.   popedom    int   --權(quán)限 (1為可用,2為不可用)  
  7. )  
  8. alter table role_popedom       --主鍵  
  9. add constraint PK_role_popedom primary key(connectionid) --主鍵  

 

 

 

【編輯推薦】

SQL數(shù)據(jù)庫操作授權(quán)

增加SQL用戶名的方法

SQL2000創(chuàng)建角色示例

帶您深入了解SQL數(shù)據(jù)庫角色

SQL Server服務(wù)器角色特性一覽

責(zé)任編輯:段燃 來源: 互聯(lián)網(wǎng)
點贊
收藏

51CTO技術(shù)棧公眾號