
[dbo].[PMPostingAccounts]
CREATE TABLE [dbo].[PMPostingAccounts]
(
[PMPostingAccountsPrikey] [int] NOT NULL IDENTITY(1, 1),
[Description] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[GLNumber] [varchar] (66) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CashAccount] [bit] NOT NULL,
[AccountingAccountFid] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PMPostingAccounts] ADD CONSTRAINT [CK_PMPostingAccounts_AccountingAccount_CashAccount] CHECK (([AccountingAccountFid] IS NULL OR [CashAccount]=(0)))
GO
ALTER TABLE [dbo].[PMPostingAccounts] ADD CONSTRAINT [CK_PMPostingAccounts_AccountingAccount_GLNumber_AccountingAccount] CHECK (([GLNumber] IS NOT NULL AND [AccountingAccountFid] IS NULL OR [GLNumber] IS NULL AND [AccountingAccountFid] IS NOT NULL))
GO
ALTER TABLE [dbo].[PMPostingAccounts] ADD CONSTRAINT [PK_PMPostingAccounts] PRIMARY KEY CLUSTERED ([PMPostingAccountsPrikey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[PMPostingAccounts] ADD CONSTRAINT [FK_PMPostingAccounts_AccountingAccount] FOREIGN KEY ([AccountingAccountFid]) REFERENCES [dbo].[AccountingAccount] ([AccountingAccountId])
GO
GRANT SELECT ON [dbo].[PMPostingAccounts] TO [MssExec]
GRANT INSERT ON [dbo].[PMPostingAccounts] TO [MssExec]
GRANT DELETE ON [dbo].[PMPostingAccounts] TO [MssExec]
GRANT UPDATE ON [dbo].[PMPostingAccounts] TO [MssExec]
GO