annotate Agendas/trunk/db/v1.0/01 - Ponentes.sql @ 244:31fb96912d37

Ticket 162: Publicaciones con Nro Orden repetido.
author juanjose.montesdeocaarbos
date Thu, 06 Oct 2011 09:09:37 -0300
parents b43dc14886e3
children
rev   line source
235
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
1 if (OBJECT_ID('Ponentes') is null)
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
2 begin
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
3 if (OBJECT_ID('OtrosPonentes') is not null)
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
4 EXEC sp_rename 'dbo.OtrosPonentes', 'Ponentes'
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
5 else
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
6 create table Ponentes (
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
7 evento_key uniqueidentifier not null,
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
8 elt uniqueidentifier not null,
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
9 constraint PK_Ponentes primary key(evento_key, elt),
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
10 constraint FK_Ponentes_Evento foreign key (evento_key) references Evento,
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
11 constraint FK_Ponentes_Persona foreign key (elt) references Persona)
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
12 end
c61954d24c8c Quitando ponente principal y utilizando siempre la lista de ponentes
nelopauselli
parents: 226
diff changeset
13 go
238
b43dc14886e3 Quitando ponente principal de la UI
nelopauselli
parents: 235
diff changeset
14
b43dc14886e3 Quitando ponente principal de la UI
nelopauselli
parents: 235
diff changeset
15 insert into Ponentes (evento_key, elt)
b43dc14886e3 Quitando ponente principal de la UI
nelopauselli
parents: 235
diff changeset
16 select e.Id, e.Ponente
b43dc14886e3 Quitando ponente principal de la UI
nelopauselli
parents: 235
diff changeset
17 from Evento e
b43dc14886e3 Quitando ponente principal de la UI
nelopauselli
parents: 235
diff changeset
18 where e.Ponente is not null and e.Ponente not in (select p.elt from Ponentes p where p.evento_key = e.Id)
b43dc14886e3 Quitando ponente principal de la UI
nelopauselli
parents: 235
diff changeset
19 go