--你说的是聚集索引和非聚集索引吧? 下面是脚本 图形操作在附件里
--新建聚集索引
ALTER TABLE 表名 ADD CONSTRAINT [PK_CBED] PRIMARY KEY CLUSTERED
(
字段名 ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
--新建非聚集索引
CREATE NONCLUSTERED INDEX [IX_BsBed] ON 表名
(
字段名 ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF,
IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
索引分为 聚集索引和 非聚集索引, 聚集索引代表了数据存储的实际顺序,所以一个表聚集索引只能有一个, 非聚集索引能有多个。。