[dbo].[InternationalBOLConsigneePhoneNumber]
CREATE TABLE [dbo].[InternationalBOLConsigneePhoneNumber]
(
[InternationalBOLConsigneePhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[InternationalBOLConsigneeFID] [int] NOT NULL,
[PhoneTypeFID] [int] NOT NULL,
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalBOLConsigneePhoneNumber] ADD CONSTRAINT [CK_InternationalBOLConsigneePhoneNumber_PhoneType] CHECK (([dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Fax' OR [dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Main'))
GO
ALTER TABLE [dbo].[InternationalBOLConsigneePhoneNumber] ADD CONSTRAINT [PK_InternationalBOLConsigneePhoneNumber] PRIMARY KEY NONCLUSTERED ([InternationalBOLConsigneePhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalBOLConsigneePhoneNumber] ADD CONSTRAINT [IX_InternationalBOLConsigneePhoneNumber_PhoneType] UNIQUE NONCLUSTERED ([InternationalBOLConsigneeFID], [PhoneTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalBOLConsigneePhoneNumber] ADD CONSTRAINT [FK_InternationalBOLConsigneePhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[InternationalBOLConsigneePhoneNumber] ADD CONSTRAINT [FK_InternationalBOLConsigneePhoneNumber_InternationalBOLConsignee] FOREIGN KEY ([InternationalBOLConsigneeFID]) REFERENCES [dbo].[InternationalBOLConsignee] ([InternationalBOLConsigneeID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[InternationalBOLConsigneePhoneNumber] ADD CONSTRAINT [FK_InternationalBOLConsigneePhoneNumber_PhoneType] FOREIGN KEY ([PhoneTypeFID]) REFERENCES [dbo].[PhoneType] ([PhoneTypeID])
GO
GRANT SELECT ON [dbo].[InternationalBOLConsigneePhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalBOLConsigneePhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalBOLConsigneePhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalBOLConsigneePhoneNumber] TO [MssExec]
GO