[dbo].[AgentContactPhoneNumber]
CREATE TABLE [dbo].[AgentContactPhoneNumber]
(
[AgentContactPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL,
[AgentContactFID] [int] NOT NULL,
[AgentContactPhoneTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AgentContactPhoneNumber] ADD CONSTRAINT [PK_AgentContactPhoneNumber] PRIMARY KEY NONCLUSTERED ([AgentContactPhoneNumberID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AgentContactPhoneNumber] ADD CONSTRAINT [IX_AgentContactPhoneNumber_AgentContactAndPhoneType] UNIQUE NONCLUSTERED ([AgentContactFID], [AgentContactPhoneTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AgentContactPhoneNumber] ADD CONSTRAINT [FK_AgentContactPhoneNumber_AgentContact] FOREIGN KEY ([AgentContactFID]) REFERENCES [dbo].[AgentContact] ([AgentContactID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[AgentContactPhoneNumber] ADD CONSTRAINT [FK_AgentContactPhoneNumber_AgentContactPhoneType] FOREIGN KEY ([AgentContactPhoneTypeFID]) REFERENCES [dbo].[AgentContactPhoneType] ([AgentContactPhoneTypeID])
GO
ALTER TABLE [dbo].[AgentContactPhoneNumber] ADD CONSTRAINT [FK_AgentContactPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
GRANT SELECT ON [dbo].[AgentContactPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[AgentContactPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[AgentContactPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[AgentContactPhoneNumber] TO [MssExec]
GO