[dbo].[InternationalBOLConsigneeAddress]
CREATE TABLE [dbo].[InternationalBOLConsigneeAddress]
(
[InternationalBOLConsigneeAddressID] [int] NOT NULL IDENTITY(1, 1),
[InternationalBOLConsigneeFID] [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].[InternationalBOLConsigneeAddress] ADD CONSTRAINT [CK_InternationalBOLConsigneeAddress_AddressType] CHECK (([dbo].[GetAddressTypeName]([AddressTypeFID])='Main'))
GO
ALTER TABLE [dbo].[InternationalBOLConsigneeAddress] ADD CONSTRAINT [PK_InternationalBOLConsigneeAddress] PRIMARY KEY CLUSTERED ([InternationalBOLConsigneeAddressID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalBOLConsigneeAddress] ADD CONSTRAINT [IX_InternationalBOLConsigneeAddress_AddressType] UNIQUE NONCLUSTERED ([InternationalBOLConsigneeFID], [AddressTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalBOLConsigneeAddress] ADD CONSTRAINT [FK_InternationalBOLConsigneeAddress_AddressType] FOREIGN KEY ([AddressTypeFID]) REFERENCES [dbo].[AddressType] ([AddressTypeID])
GO
ALTER TABLE [dbo].[InternationalBOLConsigneeAddress] ADD CONSTRAINT [FK_InternationalBOLConsigneeAddress_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[InternationalBOLConsigneeAddress] ADD CONSTRAINT [FK_InternationalBOLConsigneeAddress_InternationalBOLConsignee] FOREIGN KEY ([InternationalBOLConsigneeFID]) REFERENCES [dbo].[InternationalBOLConsignee] ([InternationalBOLConsigneeID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[InternationalBOLConsigneeAddress] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalBOLConsigneeAddress] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalBOLConsigneeAddress] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalBOLConsigneeAddress] TO [MssExec]
GO