bues

Páginas: 7 (1655 palabras) Publicado: 13 de mayo de 2014
go
create database Transfunlam
go
use transfunlam
go
create rule users as @on like 'jubilado clase A'
Or @on like 'jubilado clase B'
Or @on like 'estudiante'
go
create rule sueldos as @tipo like 'dia'
Or @tipo like 'mes'

go
create table TBL_Empleados (nitempleado integer identity (1,1) not null, idempleado integer not null, cedula_empleado integer not null, nombre varchar (50)not null, telefono integer not null, direccion varchar (50) not null)
go
create table TBL_cargo_administrativo (nitadministrativo integer identity (1,1) not null, idadministrativo integer not null, cedula_empleado integer not null,estudios varchar (50) not null)
go
create table TBL_cargo_chofer (nitchofer integer identity (1,1) not null, idchofer integer not null,cedula_empleado integer not null, hora_inicio time not null, hora_fin time not null)
go
create table TBL_cargo_guardia (nitguardia integer identity (1,1) not null, idguardia integer not null,cedula_empleado integer not null, tipo_sueldo varchar (50))
go
create table TBL_tarjeta (nittarjeta integer identity (1,1) not null, idtarjeta integer not null, codigo_tarjeta varchar (50) not null, monto_dinero integer not null)
gocreate table TBL_bus (nitbus integer identity (1,1) not null, idbus integer not null, matricula_bus varchar (50) not null, capacidad integer not null)
go
create table TBL_cliente_especial (nitespecial integer identity (1,1) not null, idespecial integer not null, cedula_cliente integer not null, clase_cliente varchar (50) not null, descuento integer not null)
go
create table TBL_cliente_comun(nitcomun integer identity (1,1) not null, idcomun integer not null, cedula_cliente integer not null)
go
create table TBL_cliente_mixto (nitmixto integer identity (1,1) not null, idmixto integer not null, cedula_cliente integer not null, descuento integer not null)
go
create table TBL_clientes (nitclientes integer identity (1,1) not null, idcliente integer not null, cedula_cliente integer notnull, nombre varchar (50) not null, telefono integer not null, edad integer not null, descuento integer not null)
go
create table TBL_registros (nitregistros integer identity (1,1) not null, idregistro integer not null, cedula_empleado integer not null, idcliente integer not null, matricula_bus varchar (50) not null, codigo_tarjeta varchar (50) not null ,descuento_final integer not null,fecha_registro datetimeoffset not null)

go
exec sp_bindrule users, 'TBL_cliente_especial.clase_cliente'
exec sp_bindrule sueldos, 'TBL_cargo_guardia.tipo_sueldo'

go
alter table TBL_Empleados add constraint cp_TBL_Empleados primary key (cedula_empleado)
alter table TBL_cliente_especial add constraint cp_TBL_cliente_especial primary key (cedula_cliente)
alter table TBL_cliente_comun addconstraint cp_TBL_cliente_comun primary key (cedula_cliente)
alter table TBL_cliente_mixto add constraint cp_TBL_cliente_mixto primary key (cedula_cliente)
alter table TBL_tarjeta add constraint cp_TBL_tarjeta primary key (codigo_tarjeta)
alter table TBL_bus add constraint cp_TBL_bus primary key (matricula_bus)
alter table TBL_clientes add constraint cp_TBL_clientes primary key (idcliente)

go
altertable TBL_cargo_administrativo add constraint caj_TBL_cargo_administrativo foreign key (cedula_empleado) references TBL_Empleados
alter table TBL_cargo_chofer add constraint caj_TBL_cargo_chofer foreign key (cedula_empleado) references TBL_Empleados
alter table TBL_cargo_guardia add constraint caj_TBL_cargo_guardia foreign key (cedula_empleado) references TBL_Empleados
alter tableTBL_clientes add constraint caj_TBL_clientes foreign key (cedula_cliente) references TBL_cliente_especial
alter table TBL_clientes add constraint caj_TBL_clientes2 foreign key (cedula_cliente) references TBL_cliente_comun
alter table TBL_clientes add constraint caj_TBL_clientes3 foreign key (cedula_cliente) references TBL_cliente_mixto
alter table TBL_registros add constraint caj_TBL_registros foreign...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Bues Escuelas
  • Jaime Bueso
  • Jose Angel Buesa
  • Jose angel buesa
  • Una breve biografía de josé angel buesa
  • Poemas de buesa
  • Antología poética J.A. Buesa
  • Jose Angel Buesa

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS