[dbo].[SysUserPhoneNumber]
CREATE TABLE [dbo].[SysUserPhoneNumber]
(
[SysUserPhoneNumberID] [int] NOT NULL IDENTITY(1, 1),
[CountryCodeStandardFID] [int] NULL,
[AreaCode] [dbo].[PhoneAreaCode] NULL,
[LocalNumber] [dbo].[PhoneLocalNumber] NULL,
[Extension] [dbo].[PhoneExtension] NULL,
[SysUserFID] [int] NOT NULL,
[SysUserPhoneTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SysUserPhoneNumber] ADD CONSTRAINT [PK_SysUserPhoneNumber] PRIMARY KEY NONCLUSTERED ([SysUserPhoneNumberID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SysUserPhoneNumber] ADD CONSTRAINT [IX_SysUserPhoneNumber_SysUserAndPhoneType] UNIQUE NONCLUSTERED ([SysUserFID], [SysUserPhoneTypeFID]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SysUserPhoneNumber] ADD CONSTRAINT [FK_SysUserPhoneNumber_CountryCodeStandard] FOREIGN KEY ([CountryCodeStandardFID]) REFERENCES [dbo].[CountryCodeStandard] ([CountryCodeStandardID])
GO
ALTER TABLE [dbo].[SysUserPhoneNumber] ADD CONSTRAINT [FK_SysUserPhoneNumber_SysUser] FOREIGN KEY ([SysUserFID]) REFERENCES [dbo].[Sysuser] ([SysUserID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[SysUserPhoneNumber] ADD CONSTRAINT [FK_SysUserPhoneNumber_SysUserPhoneType] FOREIGN KEY ([SysUserPhoneTypeFID]) REFERENCES [dbo].[SysUserPhoneType] ([SysUserPhoneTypeID])
GO
GRANT SELECT ON [dbo].[SysUserPhoneNumber] TO [MssExec]
GRANT INSERT ON [dbo].[SysUserPhoneNumber] TO [MssExec]
GRANT DELETE ON [dbo].[SysUserPhoneNumber] TO [MssExec]
GRANT UPDATE ON [dbo].[SysUserPhoneNumber] TO [MssExec]
GO