[dbo].[ProfilePhoneNumber]
CREATE TABLE [dbo].[ProfilePhoneNumber]
(
[ProfilePhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[ProfileFID] [int] NOT NULL,
[ProfilePhoneTypeFID] [int] NOT NULL,
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProfilePhoneNumber] ADD CONSTRAINT [PK_ProfilePhoneNumber] PRIMARY KEY NONCLUSTERED ([ProfilePhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProfilePhoneNumber] ADD CONSTRAINT [IX_ProfilePhoneNumber_ProfileAndPhoneType] UNIQUE NONCLUSTERED ([ProfileFID], [ProfilePhoneTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProfilePhoneNumber] ADD CONSTRAINT [FK_ProfilePhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[ProfilePhoneNumber] ADD CONSTRAINT [FK_ProfilePhoneNumber_Profiles] FOREIGN KEY ([ProfileFID]) REFERENCES [dbo].[Profiles] ([ProfileID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ProfilePhoneNumber] ADD CONSTRAINT [FK_ProfilePhoneNumber_ProfilePhoneType] FOREIGN KEY ([ProfilePhoneTypeFID]) REFERENCES [dbo].[ProfilePhoneType] ([ProfilePhoneTypeID])
GO
GRANT SELECT ON [dbo].[ProfilePhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[ProfilePhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[ProfilePhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[ProfilePhoneNumber] TO [MssExec]
GO