[dbo].[BiReportingViewHierarchy]
CREATE TABLE [dbo].[BiReportingViewHierarchy]
(
[BiReportingViewHierarchyID] [int] NOT NULL IDENTITY(1, 1),
[BiReportingViewFID] [int] NOT NULL,
[BiReportingParentViewFID] [int] NOT NULL,
[Parameters] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[BiReportingViewHierarchy] ADD CONSTRAINT [PK_BiReportingViewHierarchy] PRIMARY KEY NONCLUSTERED ([BiReportingViewHierarchyID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BiReportingViewHierarchy] ADD CONSTRAINT [IX_BiReportingViewHierarchy_ParentChild] UNIQUE NONCLUSTERED ([BiReportingParentViewFID], [BiReportingViewFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[BiReportingViewHierarchy] ADD CONSTRAINT [FK_BiReportingViewHierarchy_BiReportingParentViewFID] FOREIGN KEY ([BiReportingParentViewFID]) REFERENCES [dbo].[BiReportingView] ([BiReportingViewID])
GO
ALTER TABLE [dbo].[BiReportingViewHierarchy] ADD CONSTRAINT [FK_BiReportingViewHierarchy_BiReportingViewFID] FOREIGN KEY ([BiReportingViewFID]) REFERENCES [dbo].[BiReportingView] ([BiReportingViewID])
GO
GRANT SELECT ON [dbo].[BiReportingViewHierarchy] TO [MssExec]
GRANT INSERT ON [dbo].[BiReportingViewHierarchy] TO [MssExec]
GRANT DELETE ON [dbo].[BiReportingViewHierarchy] TO [MssExec]
GRANT UPDATE ON [dbo].[BiReportingViewHierarchy] TO [MssExec]
GO