Creating a sqlce index in code?

M

mikeb

Suppose I have the table below - I'm new to sqlce and am wondering what I
need to do to add an index to the table on trackno+factory. ??

sqlCreateTable.CommandText = _
"CREATE TABLE TestTable " & _
"(" & _
"trackno nchar (20), " & _
"factory nchar (10), " & _
"sealno nchar (40), " & _
"length nchar (04), " & _
"add_date datetime " & _
")"

sqlCreateTable.ExecuteNonQuery()
 
A

Alex Feinman [MVP]

CREATE INDEX IX_TRACKNO_FACTORY ON TestTable ( trackno, factory )

You can add UNIQUE (create unique index) and/or sort order for columns
(ASC/DESC)

See SQL CE Books Online for more information (available if you install SQL
CE from microsoft.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top