Comment changer la clé primaire pour être non-cluster?
-
25-09-2019 - |
Question
à temps partiel réticents DBA ici. Je souhaite modifier un index de clé primaire existant de cluster à la non-cluster. Et la syntaxe me échappe.
Voici comment il est scénarisé en ce moment.
ALTER TABLE [dbo].[Config] WITH NOCHECK ADD
CONSTRAINT [PK_Config] PRIMARY KEY CLUSTERED
(
[ConfigID]
) ON [PRIMARY]
Je ne vois pas une déclaration ALTER CONTRAINTE dans la documentation en ligne.
La solution
Laissez tomber l'index ordonné en clusters, puis recréez la clé primaire comme non-cluster:
ALTER TABLE dbo.Config DROP CONSTRAINT PK_Config
go
ALTER TABLE dbo.Config ADD CONSTRAINT PK_Config
PRIMARY KEY NONCLUSTERED (ConfigID)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow