SQL script create user role Permissions table

Source: Internet
Author: User
Tags create database

1 /******************************************/2 /*Name: Rights Management*/3 /*Date Written: 2010.5.20*/4 /*Developer: Dangqinghua*/ 5 /*****************************************/6 --Create Database Grop7 --Go8  UseGrop9 GoTen -----Create a user table One Create TableUsers A ( -u_idint Identity(1,1)Primary Key, -Unamevarchar( -) not NULL,  the ) - Go - ----Create a role table - Create TableRoles + ( -role_idint Identity(1,1)Primary Key, +Role_namevarchar( -) not NULL, ARloe_descriptionvarchar( -)NULL,/*Role Notes*/ at ) - Go - ----Create permission table - Create Table Fun - ( -fun_idint Identity(1,1)Primary Key,  inFun_namevarchar( -) not NULL,  - ) to Go + ---Create a User role table - Create TableUsersrole the ( *Users_roleint Identity(1,1)Primary Key, $u_idint Foreign Key ReferencesUsers (u_id),Panax Notoginsengrole_idint Foreign Key ReferencesRoles (role_id), - ) the Go + ----Create a role permission table A Create TableFunrole the ( +funrole_idint Identity(1,1)Primary Key, -fun_idint Foreign Key ReferencesFun (fun_id), $role_idint Foreign Key ReferencesRoles (role_id), $ ) - Go - Insert  intoUsersValues('111') the Insert  intoUsersValues('Zhang San') - Insert  intoUsersValues('John Doe')Wuyi Insert  intoUsersroleValues(1,1) the Insert  intoUsersroleValues(2,1) - Insert  intoRolesValues('System Users','Column Management') Wu Insert  intoRolesValues('Administrator','Management Background') - Insert  intoRolesValues('Super Management','So permissions') About Insert  intoFunroleValues(1,1) $ Insert  intoFunroleValues(2,2) - Insert  intoFunValues('New') - Insert  intoFunValues('Edit') - Insert  intoFunroleValues(1,1) A Insert  intoFunroleValues(1,2) + Select *  fromRoles the Select *  fromUsersrole - Select *  fromUsers $ Select *  from Fun the Select *  fromFunrole theCollection in .- -- -

SQL script create user role Permissions table

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.