[dbo].[MilitaryCarrierPayeeCode]
CREATE TABLE [dbo].[MilitaryCarrierPayeeCode]
(
[MilitaryCarrierPayeeCodeID] [int] NOT NULL IDENTITY(1, 1),
[MilitaryCarrierFID] [int] NOT NULL,
[Description] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[PayeeCode] [varchar] (32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[IsDefault] [bit] NOT NULL CONSTRAINT [DF_MilitaryCarrierPayeeCode_IsDefault] DEFAULT ((0))
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryCarrierPayeeCode] ADD CONSTRAINT [CK_MilitaryCarrierPayeeCode_IsDefault] CHECK (((0)=[dbo].[MilitaryCarrierPayeeCodeDefault]([MilitaryCarrierPayeeCodeID],[MilitaryCarrierFID],[IsDefault])))
GO
ALTER TABLE [dbo].[MilitaryCarrierPayeeCode] ADD CONSTRAINT [PK_MilitaryCarrierPayeeCode] PRIMARY KEY CLUSTERED ([MilitaryCarrierPayeeCodeID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryCarrierPayeeCode] ADD CONSTRAINT [IX_MilitaryCarrier_PayeeCode] UNIQUE NONCLUSTERED ([MilitaryCarrierFID], [PayeeCode]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_MilitaryCarrierPayeeCode_MilitaryCarrierFID] ON [dbo].[MilitaryCarrierPayeeCode] ([MilitaryCarrierFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[MilitaryCarrierPayeeCode] ADD CONSTRAINT [FK_MilitaryCarrierPayeeCode_MilitaryCarrier] FOREIGN KEY ([MilitaryCarrierFID]) REFERENCES [dbo].[MilitaryCarrier] ([MilitaryCarrierID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[MilitaryCarrierPayeeCode] TO [MssExec]
GRANT INSERT ON [dbo].[MilitaryCarrierPayeeCode] TO [MssExec]
GRANT DELETE ON [dbo].[MilitaryCarrierPayeeCode] TO [MssExec]
GRANT UPDATE ON [dbo].[MilitaryCarrierPayeeCode] TO [MssExec]
GO