EnVisageOnline/Beta/Database/Schema/Tables/dbo.Scenario_Detail.sql

21 lines
1.9 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].[Scenario_Detail]') AND type in (N'U'))
DROP TABLE [dbo].[Scenario_Detail]
GO
CREATE TABLE [dbo].[Scenario_Detail] (
[Id] [uniqueidentifier] NOT NULL CONSTRAINT [DF_Scenario_Detail_Id] DEFAULT (newid()),
[ParentID] [uniqueidentifier] NULL,
[ExpenditureCategoryId] [uniqueidentifier] NULL,
[WeekEndingDate] [datetime] NULL,
[Quantity] [decimal](18, 6) NULL,
[LastUpdate] [datetime] NULL,
[WeekOrdinal] [int] NULL,
[Cost] [decimal](15, 4) NULL,
CONSTRAINT [PK_Scenario_Detail] PRIMARY KEY CLUSTERED ([Id])
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Scenario_Detail] ADD CONSTRAINT [FK_ScenarioDetail_ExpenditureCategory] FOREIGN KEY ([ExpenditureCategoryId]) REFERENCES [dbo].[Expenditure_Category] ([Id])
GO