31 lines
3.1 KiB
Transact-SQL
31 lines
3.1 KiB
Transact-SQL
/*
|
||
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
|