[dbo].[InternationalConsolidatorAddress]
CREATE TABLE [dbo].[InternationalConsolidatorAddress]
(
[InternationalConsolidatorAddressID] [int] NOT NULL IDENTITY(1, 1),
[InternationalConsolidatorFID] [int] NOT NULL,
[AddressTypeFID] [int] NULL,
[Address1] [dbo].[Address] NULL,
[Address2] [dbo].[Address] NULL,
[Address3] [dbo].[Address] NULL,
[City] [dbo].[AddressCity] NULL,
[State] [dbo].[AddressState] NULL,
[PostalCode] [dbo].[AddressPostalCode] NULL,
[CountryCodeStandardFID] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalConsolidatorAddress] ADD CONSTRAINT [CK_InternationalConsolidatorAddress_AddressType] CHECK (([dbo].[GetAddressTypeName]([AddressTypeFID])='Main'))
GO
ALTER TABLE [dbo].[InternationalConsolidatorAddress] ADD CONSTRAINT [PK_InternationalConsolidatorAddress] PRIMARY KEY CLUSTERED ([InternationalConsolidatorAddressID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalConsolidatorAddress] ADD CONSTRAINT [IX_InternationalConsolidator_AddressType] UNIQUE NONCLUSTERED ([InternationalConsolidatorFID], [AddressTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalConsolidatorAddress] ADD CONSTRAINT [FK_InternationalConsolidatorAddress_AddressType] FOREIGN KEY ([AddressTypeFID]) REFERENCES [dbo].[AddressType] ([AddressTypeID])
GO
ALTER TABLE [dbo].[InternationalConsolidatorAddress] ADD CONSTRAINT [FK_InternationalConsolidatorAddress_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[InternationalConsolidatorAddress] ADD CONSTRAINT [FK_InternationalConsolidatorAddress_InternationalConsolidator] FOREIGN KEY ([InternationalConsolidatorFID]) REFERENCES [dbo].[InternationalConsolidator] ([InternationalConsolidatorID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[InternationalConsolidatorAddress] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalConsolidatorAddress] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalConsolidatorAddress] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalConsolidatorAddress] TO [MssExec]
GO