sql-server – 如何在Create Table中创建非聚簇索引?
发布时间:2020-12-12 16:43:13 所属栏目:MsSql教程 来源:网络整理
导读:Create table FavoriteDish ( FavID int identity (1,1) primary key not null,DishID int references Dishes(DishID) not null,CelebrityName nvarchar(100) nonclustered not null ) 这导致关键字’nonclustered’附近的语法错误. 我引用MSDN帮助创建表语
Create table FavoriteDish ( FavID int identity (1,1) primary key not null,DishID int references Dishes(DishID) not null,CelebrityName nvarchar(100) nonclustered not null ) 这导致关键字’nonclustered’附近的语法错误. 解决方法在线书籍的帮助事实上提到了CLUSTERED这个关键字,但它只适用于UNIQUE或PRIMARY KEY约束.这两个约束都创建一个索引,您可以指定该索引是聚类还是非聚集.您不能使用该语法创建标准的非聚簇索引. Create table FavoriteDish ( FavID int identity (1,CelebrityName nvarchar(100) constraint ux_CelebrityName unique NONCLUSTERED not null ) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |