[dbo].[InternationalCarrierPhoneNumber]
CREATE TABLE [dbo].[InternationalCarrierPhoneNumber]
(
[InternationalCarrierPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[InternationalCarrierFID] [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].[InternationalCarrierPhoneNumber] ADD CONSTRAINT [CK_InternationalCarrierPhoneNumber_PhoneType] CHECK (([dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Fax' OR [dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Main'))
GO
ALTER TABLE [dbo].[InternationalCarrierPhoneNumber] ADD CONSTRAINT [PK_InternationalCarrierPhoneNumber] PRIMARY KEY NONCLUSTERED ([InternationalCarrierPhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalCarrierPhoneNumber] ADD CONSTRAINT [IX_InternationalCarrier_PhoneType] UNIQUE NONCLUSTERED ([InternationalCarrierFID], [PhoneTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalCarrierPhoneNumber] ADD CONSTRAINT [FK_InternationalCarrierPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[InternationalCarrierPhoneNumber] ADD CONSTRAINT [FK_InternationalCarrierPhoneNumber_InternationalCarrier] FOREIGN KEY ([InternationalCarrierFID]) REFERENCES [dbo].[InternationalCarrier] ([InternationalCarrierID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[InternationalCarrierPhoneNumber] ADD CONSTRAINT [FK_InternationalCarrierPhoneNumber_PhoneType] FOREIGN KEY ([PhoneTypeFID]) REFERENCES [dbo].[PhoneType] ([PhoneTypeID])
GO
GRANT SELECT ON [dbo].[InternationalCarrierPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalCarrierPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalCarrierPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalCarrierPhoneNumber] TO [MssExec]
GO