[dbo].[InternationalLinehaulCarrierAddress]
CREATE TABLE [dbo].[InternationalLinehaulCarrierAddress]
(
[InternationalLinehaulCarrierAddressID] [int] NOT NULL IDENTITY(1, 1),
[InternationalLinehaulCarrierFID] [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].[InternationalLinehaulCarrierAddress] ADD CONSTRAINT [CK_InternationalLinehaulCarrierAddress_AddressType] CHECK (([dbo].[GetAddressTypeName]([AddressTypeFID])='Main'))
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierAddress] ADD CONSTRAINT [PK_InternationalLinehaulCarrierAddress] PRIMARY KEY CLUSTERED ([InternationalLinehaulCarrierAddressID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierAddress] ADD CONSTRAINT [IX_InternationalLinehaulCarrier_AddressType] UNIQUE NONCLUSTERED ([InternationalLinehaulCarrierFID], [AddressTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierAddress] ADD CONSTRAINT [FK_InternationalLinehaulCarrierAddress_AddressType] FOREIGN KEY ([AddressTypeFID]) REFERENCES [dbo].[AddressType] ([AddressTypeID])
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierAddress] ADD CONSTRAINT [FK_InternationalLinehaulCarrierAddress_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierAddress] ADD CONSTRAINT [FK_InternationalLinehaulCarrierAddress_InternationalLinehaulCarrier] FOREIGN KEY ([InternationalLinehaulCarrierFID]) REFERENCES [dbo].[InternationalLinehaulCarrier] ([InternationalLinehaulCarrierID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[InternationalLinehaulCarrierAddress] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalLinehaulCarrierAddress] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalLinehaulCarrierAddress] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalLinehaulCarrierAddress] TO [MssExec]
GO