如何将主键改为非聚簇?
兼职DBA不愿意来这里。我想将现有主键索引从聚集更改为非聚集。而且语法让我无法理解。
这就是现在的脚本。
ALTER TABLE [dbo].[Config] WITH NOCHECK ADD
CONSTRAINT [PK_Config] PRIMARY KEY CLUSTERED
(
[ConfigID]
) ON [PRIMARY]
我在在线文档中没有看到 ALTER CONSTRAINT 语句。
Part-time reluctant DBA here. I want to change an existing primary key index from clustered to non-clustered. And the syntax is escaping me.
This is how it's scripted out right now.
ALTER TABLE [dbo].[Config] WITH NOCHECK ADD
CONSTRAINT [PK_Config] PRIMARY KEY CLUSTERED
(
[ConfigID]
) ON [PRIMARY]
I am not seeing an ALTER CONSTRAINT statement in the online docs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
删除聚集索引,然后将主键重新创建为非聚集索引:
Drop the clustered index, then recreate the primary key as non-clustered: