USE [EnVisage]
GO


if exists (select * from sys.all_objects where object_id = OBJECT_ID('Scenario2Group') and type = 'U')
begin
	DROP TABLE [dbo].[Scenario2Group]
end
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Scenario2Group](
	[Id] [uniqueidentifier] NOT NULL,
	[ScenarioId] [uniqueidentifier] NOT NULL,
	[GroupId] [uniqueidentifier] NOT NULL
 CONSTRAINT [PK_Scenario2Group] 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].[Scenario2Group]  WITH CHECK ADD  CONSTRAINT [FK_Scenario2Group_ScenarioId] FOREIGN KEY([ScenarioId])
REFERENCES [dbo].[Scenario] ([Id])
GO

ALTER TABLE [dbo].[Scenario2Group] CHECK CONSTRAINT [FK_Scenario2Group_ScenarioId]
GO

ALTER TABLE [dbo].[Scenario2Group]  WITH CHECK ADD  CONSTRAINT [FK_Scenario2Group_GroupId] FOREIGN KEY([GroupId])
REFERENCES [dbo].[SystemAttributes] ([Id])
GO

ALTER TABLE [dbo].[Scenario2Group] CHECK CONSTRAINT [FK_Scenario2Group_GroupId]
GO

