CREATE TABLE [dbo].[AdminRole]
(
[AdminRoleID] [int] NOT NULL IDENTITY(1, 1),
[ScreenName] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[TabName] [varchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[RoleDescription] [varchar] (96) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[AdminSectionFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdminRole] ADD CONSTRAINT [PK_AdminRole] PRIMARY KEY NONCLUSTERED ([AdminRoleID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdminRole] ADD CONSTRAINT [IX_AdminRole_AdminSectionFID_RoleDescription] UNIQUE CLUSTERED ([AdminSectionFID], [RoleDescription]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdminRole] ADD CONSTRAINT [IX_AdminRole_ScreenName_TabName] UNIQUE NONCLUSTERED ([ScreenName], [TabName]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_AdminRole_RoleDescription] ON [dbo].[AdminRole] ([RoleDescription]) INCLUDE ([AdminRoleID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdminRole] ADD CONSTRAINT [FK_AdminRole_AdminSection] FOREIGN KEY ([AdminSectionFID]) REFERENCES [dbo].[AdminSection] ([AdminSectionID])
GO
GRANT SELECT ON [dbo].[AdminRole] TO [MssExec]
GRANT INSERT ON [dbo].[AdminRole] TO [MssExec]
GRANT DELETE ON [dbo].[AdminRole] TO [MssExec]
GRANT UPDATE ON [dbo].[AdminRole] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'The primary key.', 'SCHEMA', N'dbo', 'TABLE', N'AdminRole', 'COLUMN', N'AdminRoleID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The admin section this role is assigned to.', 'SCHEMA', N'dbo', 'TABLE', N'AdminRole', 'COLUMN', N'AdminSectionFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The user friendly role description.', 'SCHEMA', N'dbo', 'TABLE', N'AdminRole', 'COLUMN', N'RoleDescription'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The name of the screen this role accesses.', 'SCHEMA', N'dbo', 'TABLE', N'AdminRole', 'COLUMN', N'ScreenName'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The name of the tab on this screen this role accesses.', 'SCHEMA', N'dbo', 'TABLE', N'AdminRole', 'COLUMN', N'TabName'
GO