[dbo].[InternationalConsolidatorPhoneNumber]
CREATE TABLE [dbo].[InternationalConsolidatorPhoneNumber]
(
[InternationalConsolidatorPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[InternationalConsolidatorFID] [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].[InternationalConsolidatorPhoneNumber] ADD CONSTRAINT [CK_InternationalConsolidatorPhoneNumber_PhoneType] CHECK (([dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Fax' OR [dbo].[GetPhoneNumberTypeName]([PhoneTypeFID])='Main'))
GO
ALTER TABLE [dbo].[InternationalConsolidatorPhoneNumber] ADD CONSTRAINT [PK_InternationalConsolidatorPhoneNumber] PRIMARY KEY NONCLUSTERED ([InternationalConsolidatorPhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalConsolidatorPhoneNumber] ADD CONSTRAINT [IX_InternationalConsolidator_PhoneType] UNIQUE NONCLUSTERED ([InternationalConsolidatorFID], [PhoneTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[InternationalConsolidatorPhoneNumber] ADD CONSTRAINT [FK_InternationalConsolidatorPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[InternationalConsolidatorPhoneNumber] ADD CONSTRAINT [FK_InternationalConsolidatorPhoneNumber_InternationalConsolidator] FOREIGN KEY ([InternationalConsolidatorFID]) REFERENCES [dbo].[InternationalConsolidator] ([InternationalConsolidatorID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[InternationalConsolidatorPhoneNumber] ADD CONSTRAINT [FK_InternationalConsolidatorPhoneNumber_PhoneType] FOREIGN KEY ([PhoneTypeFID]) REFERENCES [dbo].[PhoneType] ([PhoneTypeID])
GO
GRANT SELECT ON [dbo].[InternationalConsolidatorPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalConsolidatorPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalConsolidatorPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalConsolidatorPhoneNumber] TO [MssExec]
GO