在SQLServerCE表上创建索引时,此DDL有什么问题?

在SQLServerCE表上创建索引时,此DDL有什么问题?,sql,indexing,sql-server-ce,ddl,Sql,Indexing,Sql Server Ce,Ddl,使用此代码: command.CommandText = "CREATE TABLE InventoryItems (Id nvarchar(50) NOT NULL, PackSize smallint NOT NULL, Description nvarchar(255), DeptDotSubdept float, UnitCost float, UnitList float, UPCCode nvarchar(50), UPCPackSize smallint, CRVId int);"

使用此代码:

command.CommandText = "CREATE TABLE InventoryItems (Id nvarchar(50) NOT NULL, PackSize smallint NOT NULL, Description nvarchar(255), DeptDotSubdept float, UnitCost float, UnitList float, UPCCode nvarchar(50), UPCPackSize smallint, CRVId int);"
command.ExecuteNonQuery();

command.CommandText = "CREATE INDEX idxUnitCost ON InventoryItems (UnitCost) ASC";
command.ExecuteNonQuery();
…我得到,“解析查询时出错…错误中的令牌=ASC”

我的“ASC”是在错误的位置,还是


CREATE[CLUSTERED | NONCLUSTERED]INDEX idxUnitCost——哦,“ASC”必须在列名后面的括号内?我想有人认为你的语法是对集群和非集群都说的;他们的评论不见了,所以他们一定已经删除了。是的,对于列名,如果你有多个列名,而不是你希望你的索引排序的列名,比如(Column1,Column2 ASC)不,我提到了两个主要选项,并将它们放在方括号中,说明你的索引类型在那里,不管怎样,有些人很快就投了反对票:)
CREATE [CLUSTERED| NONCLUSTERED] INDEX idxUnitCost --<-- Type of Index [CLUSTERED OR NONCLUSTERED] 
ON InventoryItems (UnitCost ASC)         --<-- Order Inside the Parenthesis