Вы находитесь на странице: 1из 2

create database Comercio

on Primary
(name='Datos1',filename='c:\Datos\Datos1.mdf',
size=15MB,maxsize=20MB,filegrowth=25%
)
log on
(name='DatosLog',filename='c:\Datos\DatosLog.ldf',
size=10MB,maxsize=15MB,filegrowth=25%
)
use Comercio
Alter database Comercio add filegroup segundo
Alter database Comercio add filegroup tercero
Alter Database Comercio
add file
(name='Datos2',filename='c:\Datos\Datos2.ndf',
size=10MB,maxsize=15MB,filegrowth=25%)
to filegroup segundo
Alter Database Comercio
add file
(name='Datos3',filename='c:\Datos\Datos3.ndf',
size=10MB,maxsize=15MB,filegrowth=25%
) to filegroup tercero
--creacin de la funcin 1
create partition function fragmento1(varchar(50))
as range Right
for values ('G','N')
--A a F particion1
--G a M particion2
--N a Z particion3
--creacion del esquema de particion 1
create PARTITION SCHEME NombreEsqPart
as partition fragmento1 to
([Primary],segundo,tercero)
create table Cliente (id_cliente numeric, apellidos varchar(50), nombre varchar(
30),
id_cuenta numeric, telefono varchar(15), direccion varchar(35)) on EsqCli(apelli
dos);
insert into cliente values (1,'Antnez Gonzlez','Ramiro',001,'123456789','Centro')
insert into cliente values (2,'Islas Romero','Gerardo',002,'456789123','Norte')
insert into cliente values (3,'Zapata Robles','Luis',003,'987654321','Sur')
insert into cliente values (4,'Ares Coln','Patricio',003,'987654321','Sur')
insert into cliente values (5,'Butrago Poveda','Jairo',003,'987654321','Sur')
insert into cliente values (6,'Gonzalez Garcia','Emilio',003,'987654321','Sur')
insert into cliente values (7,'Nieves Cant','Jos',003,'987654321','Sur')
insert into cliente values (8,'Morales Reyes','Carlos',003,'987654321','Sur')
insert into cliente values (9,'Fernandez Hipolito','Luis',003,'987654321','Sur')
select id_cliente, apellidos, nombre,
$partition.fragmento1(apellidos)
as partition from Cliente order by apellidos

drop table Cliente;

Вам также может понравиться