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

31 lines
3.1 KiB
Transact-SQL
Raw 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].[Expenditure_Category]') AND type in (N'U'))
DROP TABLE [dbo].[Expenditure_Category]
GO
CREATE TABLE [dbo].[Expenditure_Category] (
[Id] [uniqueidentifier] NOT NULL,
[ExpenditureId] [uniqueidentifier] NULL,
[GLId] [uniqueidentifier] NULL,
[UOMId] [uniqueidentifier] NULL,
[CreditId] [uniqueidentifier] NULL,
[Type] [int] NULL,
[UseType] [int] NULL,
[CGEFX] [char](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SortOrder] [int] NULL,
[WksSubjectToFee] [int] NULL,
[SystemAttributeOne] [uniqueidentifier] NULL,
[SystemAttributeTwo] [uniqueidentifier] NULL,
CONSTRAINT [PK_Expenditure_CategoryID] PRIMARY KEY CLUSTERED ([Id])
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Expenditure_Category] ADD CONSTRAINT [FK_Expenditure_Category_CreditDepartment] FOREIGN KEY ([CreditId]) REFERENCES [dbo].[CreditDepartment] ([Id])
GO
ALTER TABLE [dbo].[Expenditure_Category] ADD CONSTRAINT [FK_Expenditure_Category_GLDepartment] FOREIGN KEY ([GLId]) REFERENCES [dbo].[GLDepartment] ([Id])
GO
ALTER TABLE [dbo].[Expenditure_Category] ADD CONSTRAINT [FK_Expenditure_Category_UOM] FOREIGN KEY ([UOMId]) REFERENCES [dbo].[UOM] ([Id])
GO
ALTER TABLE [dbo].[Expenditure_Category] ADD CONSTRAINT [FK_ExpenditureCategory_Expenditure] FOREIGN KEY ([ExpenditureId]) REFERENCES [dbo].[Expenditure] ([Id])
GO