Question

With this code:

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();

...I get, "There was an error parsing the query .... Token in error = ASC"

Is my "ASC" in the wrong location, or...???

Was it helpful?

Solution

CREATE [CLUSTERED| NONCLUSTERED] INDEX idxUnitCost --<-- Type of Index [CLUSTERED OR NONCLUSTERED] 
ON InventoryItems (UnitCost ASC)         --<-- Order Inside the Parenthesis
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top