[dbo].[InternationalLinehaulCarrierPhoneNumber]
CREATE TABLE [dbo].[InternationalLinehaulCarrierPhoneNumber]
(
[InternationalLinehaulCarrierPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[InternationalLinehaulCarrierFID] [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].[InternationalLinehaulCarrierPhoneNumber] ADD CONSTRAINT [CK_InternationalLinehaulCarrierPhoneNumber_PhoneType] CHECK (([dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Fax' OR [dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Main'))
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierPhoneNumber] ADD CONSTRAINT [PK_InternationalLinehaulCarrierPhoneNumber] PRIMARY KEY NONCLUSTERED ([InternationalLinehaulCarrierPhoneNumberID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierPhoneNumber] ADD CONSTRAINT [IX_InternationalLinehaulCarrier_PhoneType] UNIQUE NONCLUSTERED ([InternationalLinehaulCarrierFID], [PhoneTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierPhoneNumber] ADD CONSTRAINT [FK_InternationalLinehaulCarrierPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierPhoneNumber] ADD CONSTRAINT [FK_InternationalLinehaulCarrierPhoneNumber_InternationalLinehaulCarrier] FOREIGN KEY ([InternationalLinehaulCarrierFID]) REFERENCES [dbo].[InternationalLinehaulCarrier] ([InternationalLinehaulCarrierID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[InternationalLinehaulCarrierPhoneNumber] ADD CONSTRAINT [FK_InternationalLinehaulCarrierPhoneNumber_PhoneType] FOREIGN KEY ([PhoneTypeFID]) REFERENCES [dbo].[PhoneType] ([PhoneTypeID])
GO
GRANT SELECT ON [dbo].[InternationalLinehaulCarrierPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalLinehaulCarrierPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalLinehaulCarrierPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalLinehaulCarrierPhoneNumber] TO [MssExec]
GO