表格定义:
CREATE TABLE [dbo].[Visualization_ComponentLayouts]
(
[ComponentLayoutId] [int] IDENTITY(1,1) NOT NULL,
[ComponentId] [int] NOT NULL,
[LayoutId] [int] NOT NULL,
[UnitTypeId] [int] NOT NULL,
[ProjectId] [int] NOT NULL,
[CreatedBy] [int] NULL,
[ModifiedBy] [int] NULL,
CONSTRAINT [PK_Visualization_ComponentLayouts] PRIMARY KEY CLUSTERED
(
[ComponentLayoutId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Visualization_ComponentLayouts] WITH NOCHECK
ADD CONSTRAINT [FK_Visualization_ComponentLayouts_Visualization_ComponentInfo]
FOREIGN KEY([ComponentId])
REFERENCES [dbo].[Visualization_ComponentInfo] ([ComponentId])
GO
ALTER TABLE [dbo].[Visualization_ComponentLayouts] CHECK CONSTRAINT [FK_Visualization_ComponentLayouts_Visualization_ComponentInfo]
GO
ALTER TABLE [dbo].[Visualization_ComponentLayouts] WITH CHECK
ADD CONSTRAINT [FK_Visualization_ComponentLayouts_Visualization_Layouts]
FOREIGN KEY([LayoutId], [ProjectId])
REFERENCES [dbo].[Visualization_Layouts] ([LayoutId], [ProjectId])
GO
ALTER TABLE [dbo].[Visualization_ComponentLayouts] CHECK CONSTRAINT [FK_Visualization_ComponentLayouts_Visualization_Layouts]
GO
查询放弃约束:
ALTER TABLE Visualization_ComponentLayouts
DROP CONSTRAINT FK_Visualization_ComponentLayouts_Visualization_Layouts
执行上面的drop查询时出错:
'FK_Visualization_ComponentLayouts_Visualization_Layouts'不是 约束。无法删除约束。查看以前的错误。
在SQL Server Management Studio中,在对象资源管理器中,当我展开表节点时,当我展开约束节点时,在那里没有列出任何约束。
执行查询时:EXEC sp_help 'Visualization_ComponentLayouts'
我得到了以下信息:
我做错了什么?