/* 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].[PeopleResourceAllocation]') AND type in (N'U')) DROP TABLE [dbo].[PeopleResourceAllocation] GO CREATE TABLE [dbo].[PeopleResourceAllocation] ( [Id] [uniqueidentifier] NOT NULL, [ResourceId] [uniqueidentifier] NOT NULL, [ScenarioId] [uniqueidentifier] NOT NULL, [ExpenditureCategoryId] [uniqueidentifier] NOT NULL, [StartDate] [date] NOT NULL, [EndDate] [date] NOT NULL, [AllocatePercentage] [float] NOT NULL, CONSTRAINT [PK_ResourceAllocation] PRIMARY KEY CLUSTERED ([Id]) ) ON [PRIMARY] GO ALTER TABLE [dbo].[PeopleResourceAllocation] ADD CONSTRAINT [FK_ResourceAllocation_Expenditure_Category] FOREIGN KEY ([ExpenditureCategoryId]) REFERENCES [dbo].[Expenditure_Category] ([Id]) GO ALTER TABLE [dbo].[PeopleResourceAllocation] ADD CONSTRAINT [FK_ResourceAllocation_Scenario] FOREIGN KEY ([ScenarioId]) REFERENCES [dbo].[Scenario] ([Id]) GO