Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/06/2012, 09:15
treces
 
Fecha de Ingreso: mayo-2012
Mensajes: 20
Antigüedad: 12 años, 7 meses
Puntos: 0
Respuesta: clave foranea

USE [cms]
GO

/****** Object: Table [dbo].[SbiSiteBehavior] Script Date: 06/15/2012 10:37:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[SbiSiteBehavior](
[SbiID] [int] NOT NULL,
[Server] [smallint] NOT NULL,
[Site] [smallint] NOT NULL,
[Behavior] [smallint] NOT NULL,
[Imported] [bit] NOT NULL,
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
CONSTRAINT [SbiSiteBehavior_PK] PRIMARY KEY CLUSTERED
(
[SbiID] ASC,
[Site] ASC,
[Behavior] 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

EXEC sys.sp_addextendedproperty @name=N'Version', @value=N'$Revision: 6 $' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'SbiSiteBehavior '
GO

ALTER TABLE [dbo].[SbiSiteBehavior] WITH NOCHECK ADD CONSTRAINT [FK_SbiSiteBehavior_Sbi] FOREIGN KEY([SbiID])
REFERENCES [dbo].[Sbi] ([SbiId])
NOT FOR REPLICATION
GO

ALTER TABLE [dbo].[SbiSiteBehavior] CHECK CONSTRAINT [FK_SbiSiteBehavior_Sbi]
GO

ALTER TABLE [dbo].[SbiSiteBehavior] WITH NOCHECK ADD CONSTRAINT [SbiSiteBehavior_F01] FOREIGN KEY([Behavior], [Server])
REFERENCES [dbo].[AC_BEHAVIOR] ([BEHAVIOR_ID], [SERVER_ID])
NOT FOR REPLICATION
GO

ALTER TABLE [dbo].[SbiSiteBehavior] CHECK CONSTRAINT [SbiSiteBehavior_F01]
GO

ALTER TABLE [dbo].[SbiSiteBehavior] ADD DEFAULT ((1)) FOR [Server]
GO

ALTER TABLE [dbo].[SbiSiteBehavior] ADD DEFAULT ((0)) FOR [Imported]
GO

ALTER TABLE [dbo].[SbiSiteBehavior] ADD DEFAULT (newid()) FOR [rowguid]
GO







USE [cms]
GO

/****** Object: Table [dbo].[AC_BEHAVIOR] Script Date: 06/15/2012 10:37:25 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[AC_BEHAVIOR](
[BEHAVIOR_ID] [smallint] NOT NULL,
[DESCRIPTION] [nvarchar](35) NULL,
[SITE] [smallint] NULL,
[SERVER_ID] [smallint] NOT NULL,
[LocationTagName] [dbo].[LocationTagNameType] NOT NULL,
[rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL,
CONSTRAINT [PK_AC_BEHAVIOR] PRIMARY KEY CLUSTERED
(
[BEHAVIOR_ID] ASC,
[SERVER_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

EXEC sys.sp_addextendedproperty @name=N'Version', @value=N'$Revision: 7 $' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'AC_BEHAVIOR'
GO

ALTER TABLE [dbo].[AC_BEHAVIOR] WITH NOCHECK ADD CONSTRAINT [AC_BEHAVIOR_F01] FOREIGN KEY([SITE])
REFERENCES [dbo].[AC_SITE] ([SITE])
NOT FOR REPLICATION
GO

ALTER TABLE [dbo].[AC_BEHAVIOR] CHECK CONSTRAINT [AC_BEHAVIOR_F01]
GO

ALTER TABLE [dbo].[AC_BEHAVIOR] ADD DEFAULT ((1)) FOR [SERVER_ID]
GO

ALTER TABLE [dbo].[AC_BEHAVIOR] ADD DEFAULT (newid()) FOR [rowguid]
GO



quiero es modificar mi taba sbisitebehavior el campo behavior