view Agendas/trunk/db/v1.1/02 - Patrocinadores.sql @ 300:48ab8788bd19

#200: Patrocinadores: Agregar link al sitio web.
author juanjose.montesdeocaarbos
date Mon, 27 Feb 2012 14:45:12 -0300
parents eeca9ddb330a
children
line wrap: on
line source

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Patrocinadores_Evento]') AND parent_object_id = OBJECT_ID(N'[dbo].[Patrocinadores]'))
ALTER TABLE [dbo].[Patrocinadores] DROP CONSTRAINT [FK_Patrocinadores_Evento]
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_Patrocinadores_Patrocinador]') AND parent_object_id = OBJECT_ID(N'[dbo].[Patrocinadores]'))
ALTER TABLE [dbo].[Patrocinadores] DROP CONSTRAINT [FK_Patrocinadores_Patrocinador]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Patrocinadores]') AND type in (N'U'))
DROP TABLE [dbo].[Patrocinadores]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Patrocinador]') AND type in (N'U'))
DROP TABLE [dbo].[Patrocinador]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Patrocinador](
	[Id] [uniqueidentifier] NOT NULL,
	[Nombre] [nvarchar](255) NULL,
	[Logo] [varbinary](8000) NULL,
PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Patrocinadores](
	[evento_key] [uniqueidentifier] NOT NULL,
	[elt] [uniqueidentifier] NOT NULL,
	[idx] [int] NOT NULL,
PRIMARY KEY CLUSTERED 
(
	[evento_key] ASC,
	[idx] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[Patrocinadores]  WITH CHECK ADD  CONSTRAINT [FK_Patrocinadores_Evento] FOREIGN KEY([evento_key])
REFERENCES [dbo].[Evento] ([Id])
GO

ALTER TABLE [dbo].[Patrocinadores] CHECK CONSTRAINT [FK_Patrocinadores_Evento]
GO

ALTER TABLE [dbo].[Patrocinadores]  WITH CHECK ADD  CONSTRAINT [FK_Patrocinadores_Patrocinador] FOREIGN KEY([elt])
REFERENCES [dbo].[Patrocinador] ([Id])
GO
ALTER TABLE [dbo].[Patrocinadores] CHECK CONSTRAINT [FK_Patrocinadores_Patrocinador]
GO