Connecting Tech Pros Worldwide Help | Site Map

How to create non-unique index with DDL?

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 12th, 2005, 06:40 PM
deko
Guest
 
Posts: n/a
Default How to create non-unique index with DDL?

I'd like to use DDL (Data Definition Language) rather than VBA code to create a
new table. The below DDL statement creates the table very nicely:

CREATE TABLE tblTx03 (Subject Text (100), Entity_ID Long, TxDate Date, Tx_ID
AutoIncrement Constraint PrimaryKey PRIMARY KEY);

The problem is I want a non-unique index on TxDate - can this be done in the
same statement?

Or do I need to run a separate statement to add the non-unique index?

CREATE INDEX idxTxDate ON tblTx03 ( TxDate ASC );

Thanks in advance.



  #2  
Old November 12th, 2005, 06:42 PM
Dimitri Furman
Guest
 
Posts: n/a
Default Re: How to create non-unique index with DDL?

On Jan 29 2004, 11:48 am, "deko" <dje422@hotmail.com> wrote in
news:GPaSb.7492$Mv1.5140@newssvr29.news.prodigy.co m:
[color=blue]
> I'd like to use DDL (Data Definition Language) rather than VBA code to
> create a new table. The below DDL statement creates the table very
> nicely:
>
> CREATE TABLE tblTx03 (Subject Text (100), Entity_ID Long, TxDate
> Date, Tx_ID
> AutoIncrement Constraint PrimaryKey PRIMARY KEY);
>
> The problem is I want a non-unique index on TxDate - can this be done
> in the same statement?[/color]

According to Help, only unique or primary key indexes can be specified in
the CREATE TABLE statement in Jet, both 3.5 and 4.0.
[color=blue]
> Or do I need to run a separate statement to add the non-unique index?
>
> CREATE INDEX idxTxDate ON tblTx03 ( TxDate ASC );[/color]

This will do it. You may want to wrap both statements in a transaction.

--
(remove a 9 to reply by email)
  #3  
Old November 12th, 2005, 06:42 PM
deko
Guest
 
Posts: n/a
Default Re: How to create non-unique index with DDL?

10-4

I discovered Microsoft Knowledge Base Article 180841, which is also helpful...

"Dimitri Furman" <dfurman@cloud99.net> wrote in message
news:Xns947FD0799180Ddfurmancloud99@127.0.0.1...[color=blue]
> On Jan 29 2004, 11:48 am, "deko" <dje422@hotmail.com> wrote in
> news:GPaSb.7492$Mv1.5140@newssvr29.news.prodigy.co m:
>[color=green]
> > I'd like to use DDL (Data Definition Language) rather than VBA code to
> > create a new table. The below DDL statement creates the table very
> > nicely:
> >
> > CREATE TABLE tblTx03 (Subject Text (100), Entity_ID Long, TxDate
> > Date, Tx_ID
> > AutoIncrement Constraint PrimaryKey PRIMARY KEY);
> >
> > The problem is I want a non-unique index on TxDate - can this be done
> > in the same statement?[/color]
>
> According to Help, only unique or primary key indexes can be specified in
> the CREATE TABLE statement in Jet, both 3.5 and 4.0.
>[color=green]
> > Or do I need to run a separate statement to add the non-unique index?
> >
> > CREATE INDEX idxTxDate ON tblTx03 ( TxDate ASC );[/color]
>
> This will do it. You may want to wrap both statements in a transaction.
>
> --
> (remove a 9 to reply by email)[/color]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.