Re: Creating a sqlce index in code?

From: Alex Feinman [MVP] (public_news_at_alexfeinman.com)
Date: 02/18/05


Date: Thu, 17 Feb 2005 18:43:57 -0800

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)

-- 
Alex Feinman
---
Visit http://www.opennetcf.org
"mikeb" <mike@nohostanywhere.com> wrote in message 
news:%23tILxhVFFHA.3924@TK2MSFTNGP09.phx.gbl...
> 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()
> 


Relevant Pages

  • Re: NULLs
    ... Can you tell us what part of the SQL '92 standard it says this? ... SQL> create unique index unq_allnulltest on allnulltest ...
    (comp.databases.oracle.server)
  • Re: Duplicating data in continuous subform linked to SQL
    ... tables to a SQL 2008 DB that was upsized with Access 2003 to SQL 2005 then ... have a primary key or that Access has some trouble finding it or using it; ... using this second unique index as the primary key. ... you should take a look with the SQL-Server Profiler to see ...
    (microsoft.public.access.adp.sqlserver)
  • Re: join tables sequencialy
    ... i have 2 tables with the exact field structure and names, ... One thing that may not be obvious: there is *nothing* magical about SQL. ... local table in Access with the same 240 fields; you can set a unique Index on ... you can remove the duplicates later if need be. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Unique Columns
    ... right clicked on the field and selected Indexes/Keys ... The SQL has an ID but would also like to have another ... CREATE UNIQUE INDEX IX_tablename_columnname_U ... This email account is my spam trap so I ...
    (microsoft.public.inetserver.asp.db)
  • Re: Compound index and unique
    ... Forget about using a UNIQUE index, you're just asking for trouble and/or ... If you need a list for display purposes, then do a SQL SELECT using the ... Microsoft Visual FoxPro MVP ... "Charles" wrote in message ...
    (microsoft.public.fox.vfp.queries-sql)