CREATE TABLE [dbo].[Payments]
(
[PaymentPriKey] [int] NOT NULL IDENTITY(1, 1),
[BMinPriKey] [int] NULL,
[PaymentDate] [datetime] NULL,
[PaymentAmount] [money] NULL,
[SDPriKey] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Payments] ADD CONSTRAINT [PK_Payments] PRIMARY KEY CLUSTERED ([PaymentPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Payments_BMinPriKey] ON [dbo].[Payments] ([BMinPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Payments_SDPriKey] ON [dbo].[Payments] ([SDPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Payments] ADD CONSTRAINT [FK_Payments_BillingMinorItem] FOREIGN KEY ([BMinPriKey]) REFERENCES [dbo].[BillingMinorItem] ([BMinPriKey])
GO
ALTER TABLE [dbo].[Payments] ADD CONSTRAINT [FK_Payments_StatementDetail] FOREIGN KEY ([SDPriKey]) REFERENCES [dbo].[StatementDetail] ([SDPriKey])
GO
GRANT SELECT ON [dbo].[Payments] TO [MssExec]
GRANT INSERT ON [dbo].[Payments] TO [MssExec]
GRANT DELETE ON [dbo].[Payments] TO [MssExec]
GRANT UPDATE ON [dbo].[Payments] TO [MssExec]
GO