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

22 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].[Rate]') AND type in (N'U'))
DROP TABLE [dbo].[Rate]
GO
CREATE TABLE [dbo].[Rate] (
[Id] [uniqueidentifier] NOT NULL CONSTRAINT [DF_Rate_Id] DEFAULT (newid()),
[ParentId] [uniqueidentifier] NULL,
[ExpenditureCategoryId] [uniqueidentifier] NULL,
[Rate] [decimal](15, 4) NULL,
[StartDate] [datetime] NULL,
[EndDate] [datetime] NULL,
[FreezeRate] [int] NULL,
[Type] [smallint] NOT NULL CONSTRAINT [DF__Rate__TypeInt__7E37BEF6] DEFAULT ((0)),
[DerivedId] [uniqueidentifier] NULL,
CONSTRAINT [PK_RateID] PRIMARY KEY CLUSTERED ([Id])
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Rate] ADD CONSTRAINT [FK_Rate_ExpenditureCategory] FOREIGN KEY ([ExpenditureCategoryId]) REFERENCES [dbo].[Expenditure_Category] ([Id])
GO