EnVisageOnline/Main-RMO/Database/Schema/Tables/dbo.Scenario2Group.sql

18 lines
1.6 KiB
Transact-SQL
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Run this script on SQL Server 2008 or later. There may be flaws if running on earlier versions of SQL Server.
*/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Scenario2Group]') AND type in (N'U'))
DROP TABLE [dbo].[Scenario2Group]
GO
CREATE TABLE [dbo].[Scenario2Group] (
[Id] [uniqueidentifier] NOT NULL,
[ScenarioId] [uniqueidentifier] NOT NULL,
[GroupId] [uniqueidentifier] NOT NULL,
CONSTRAINT [PK_Scenario2Group] PRIMARY KEY CLUSTERED ([Id])
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Scenario2Group] ADD CONSTRAINT [FK_Scenario2Group_GroupId] FOREIGN KEY ([GroupId]) REFERENCES [dbo].[SystemAttributes] ([Id])
GO
ALTER TABLE [dbo].[Scenario2Group] ADD CONSTRAINT [FK_Scenario2Group_ScenarioId] FOREIGN KEY ([ScenarioId]) REFERENCES [dbo].[Scenario] ([Id])
GO