我想做批量插入,但需要很长时间。我的想法是禁用表上的索引,以便更快地执行INSERT。但在那之后我得到了这个错误:
错误:查询处理器无法生成计划,因为表或视图“
CRMD_MKTTG_TG_I~0
”上的索引CRMD_MKTTG_TG_I
已被禁用。
我用这个脚本生成我的表:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [CRMD_MKTTG_TG_I](
[CLIENT] [nvarchar](3) NOT NULL,
[GUID] [varbinary](16) NOT NULL,
[TG_GUID] [varbinary](16) NULL,
[BP_GUID] [varbinary](16) NULL,
[BP_ORG] [nvarchar](2) NOT NULL,
[BP_DEL] [nvarchar](1) NOT NULL,
[REL_GUID] [varbinary](16) NULL,
[RELATIONSHIP] [nvarchar](6) NOT NULL,
[TYPE_BP_GUID] [nvarchar](1) NOT NULL,
[TYPE_REL_GUID] [nvarchar](1) NOT NULL,
[ROW_NUMBER] [int] NOT NULL,
CONSTRAINT [CRMD_MKTTG_TG_I~0] PRIMARY KEY CLUSTERED
(
[CLIENT] ASC,
[GUID] 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
SET ANSI_PADDING OFF
GO
任何想法?
答案 0 :(得分:4)
[CRMD_MKTTG_TG_I~0]
是聚集索引。如果禁用它,则无法访问数据(选择,插入,更新,删除数据)。
阅读Disable Indexes and Constraints:
在这种情况下,您只能: