USE [EnVisage]
GO

IF  EXISTS (SELECT * FROM sys.tables where name='StrategicGoal2Company')
set noexec on

CREATE TABLE [dbo].[StrategicGoal2Company](
	[Id] [uniqueidentifier] NOT NULL,
	[StrategicGoalId] [uniqueidentifier] NOT NULL,
	[CompanyId] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_StrategicGoal2Company] 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

ALTER TABLE [dbo].[StrategicGoal2Company]  WITH CHECK ADD  CONSTRAINT [FK_StrategicGoal2Company_Company] FOREIGN KEY([CompanyId])
REFERENCES [dbo].[Company] ([Id])
GO

ALTER TABLE [dbo].[StrategicGoal2Company] CHECK CONSTRAINT [FK_StrategicGoal2Company_Company]
GO

ALTER TABLE [dbo].[StrategicGoal2Company]  WITH CHECK ADD  CONSTRAINT [FK_StrategicGoal2Company_Goal] FOREIGN KEY([StrategicGoalId])
REFERENCES [dbo].[StrategicGoal] ([Id])
GO

ALTER TABLE [dbo].[StrategicGoal2Company] CHECK CONSTRAINT [FK_StrategicGoal2Company_Goal]

GO
