我想存储喜欢上哪些表和列与查询其创建等方面的看法元信息,到另一个映射表,这样我就可以复制它们的时间后的点。
现在,我有一个这样的结构 -
CREATE TABLE [dbo].[MAPPING_VIEW]
(
[ID] [int] NOT NULL,
[OLD_VIEW] [varchar](40) NULL,
[NEW_VIEW] [varchar](40) NULL,
CONSTRAINT [PK_MAPPING_VIEW] PRIMARY KEY CLUSTERED
([ID] ASC)
)
CREATE TABLE [dbo].[MAPPING_VIEW_TBL]
(
[ID] [int] NULL,
[PARENT_ID] [int] NULL,
[OLD_TBL] [varchar](40) NULL,
[NEW_TBL] [varchar](40) NULL
)
ALTER TABLE [dbo].[MAPPING_VIEW_TBL] WITH NOCHECK
ADD CONSTRAINT [FK_MAPPING_VIEW_TBL_ID]
FOREIGN KEY([PARENT_ID]) REFERENCES [dbo].[MAPPING_VIEW] ([ID])
CREATE TABLE [dbo].[MAPPING_VIEW_TBL_COL]
(
[ID] [int] NULL,
[PARENT_ID] [int] NULL,
[VIEW_ID] [int] NULL,
[OLD_COL] [varchar](40) NULL,
[NEW_COL] [varchar](40) NULL,
[OLD_ALIAS] [varchar](40) NULL,
[NEW_ALIAS] [varchar](40) NULL
)
ALTER TABLE [dbo].[MAPPING_VIEW_TBL_COL] WITH NOCHECK
ADD CONSTRAINT [FK_MAPPING_VIEW_TBL_COL_PARENT_ID]
FOREIGN KEY([PARENT_ID]) REFERENCES [dbo].[MAPPING_TBL] ([ID])
ALTER TABLE [dbo].[MAPPING_VIEW_TBL_COL] WITH NOCHECK
ADD CONSTRAINT [FK_MAPPING_VIEW_TBL_COL_VIEW_ID]
FOREIGN KEY([VIEW_ID]) REFERENCES [dbo].[MAPPING_VIEW] ([ID])
我知道,这是不够的。 任何建议,将不胜感激