Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- USE MASTER
- GO
- CREATE DATABASE MyBD060314
- GO
- USE MyBD060314
- GO
- --CREEMOS LOS SCHEMES
- CREATE SCHEMA SCHRRHH
- GO
- CREATE SCHEMA SCHSales
- GO
- CREATE SCHEMA SCHProduction
- GO
- CREATE SCHEMA SCHCompras
- GO
- --VER SCHEMAS
- SELECT * FROM SYS.schemas
- GO
- --CREANDO TABLAx
- CREATE TABLE TXXX
- (
- campo1 CHAR(5),
- campo2 VARCHAR(20),
- )
- GO
- --CREANDO TABLAS EN ESQUEMAS DEFINIDOS
- CREATE TABLE SCHSales.TBCLIENTE
- (
- cli_id INT,
- cli_nom VARCHAR(30),
- cli_dir VARCHAR(30),
- cli_tel VARCHAR(30),
- cli_monto MONEY
- )
- --ON SCPCLIENTE(cli_monto)
- GO
- CREATE TABLE SCHRRHH.TBPERSONAL
- (
- per_id INT IDENTITY(1001,1),
- per_nom VARCHAR(30),
- per_ap VARCHAR(30),
- per_fna DATE,
- per_sue MONEY
- )
- GO
- CREATE TABLE SCHCompras.TBPROVEEDOR
- (
- prv_id INT IDENTITY,
- prv_rzn VARCHAR(30),
- prv_dir VARCHAR(30),
- prv_cont VARCHAR(30)
- )
- GO
- CREATE TABLE SCHProduction.TBPRODUCTO
- (
- pro_id CHAR(8) NOT NULL,
- pro_desc VARCHAR(30),
- pro_marca VARCHAR(30),
- pro_precio MONEY
- )
- GO
- /*-----------------------------------------------*/
- /******************CREACION DE LOGIN************/
- CREATE LOGIN LgMaggie
- WITH PASSWORD = '123'
- GO
- /****************CREACION DE USUARIOS***********/
- CREATE USER usrMaggie
- FOR LOGIN LgMaggie
- WITH DEFAULT_SCHEMA = [SCHSales]
- GO
- /*AUTORIZANDO EL USO DEL SCHEMA Y SUS OBJETOS AL USUARIO*/
- ALTER AUTHORIZATION ON SCHEMA::[SCHSales] TO [usrMaggie]
- GO
- /*
- Volver a logeoar y notar que solo se muestra los esquemas
- autorizados
- */
- /*********************************************/
- CREATE LOGIN LgJavier
- WITH PASSWORD ='abc'
- GO
- CREATE USER usrJavier
- FOR LOGIN LgJavier
- WITH DEFAULT_SCHEMA =[SCHRRHH]
- GO
- ALTER AUTHORIZATION ON SCHEMA::[SCHRRHH] TO [usrJavier]
- GO
- /*********************************************/
- CREATE LOGIN LgHernan
- WITH PASSWORD ='abc'
- GO
- CREATE USER usrHernan
- FOR LOGIN LgHernan
- WITH DEFAULT_SCHEMA =[SCHProduction]
- GO
- ALTER AUTHORIZATION ON SCHEMA::[SCHProduction] TO [usrHernan]
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement