That did it!! Thanks much Matt.


And thanks all the others for chipping in as well.


Robert O.

-----Original Message-----
From: Matt Robertson [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 2:39 PM
To: CF-Talk
Subject: RE: Create table ID field

No.  That was a complete example of a table with an index (a table where
I validate data at the code level, hence the allowance of null values,
which is something that will be ignored on all Access versions prior to
XP).  This line sets up the autonumbered primary key:

ID COUNTER not NULL PRIMARY KEY

Of course name your pk to whatever you like.  I call mine "ID"

I know this code works on all versions of Access from '97 to XP.  No
idea if your version works at all.  I know Access has more MSSQL-like
features, but have never bothered to explore the details.

--------------------------------------------
Matt Robertson       [EMAIL PROTECTED]
MSB Designs, Inc.   http://mysecretbase.com
--------------------------------------------

-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 11:22 AM
To: CF-Talk
Subject: RE: Create table ID field

Matt,

This is the code I have:
<CFQuery datasource="test" name="#trialname#">
Create table #trialname#
(
id INTEGER,
CONSTRAINT #trialname#_pkey not null PRIMARY KEY (id),
Orderdate Char (50) not null,
Institution Char (50) not null...

Do I jhave to add all those fields you specified  just to make it
autonumber?

Thx.

RO

-----Original Message-----
From: Matt Robertson [mailto:[EMAIL PROTECTED]
Sent: Friday, January 02, 2004 12:43 PM
To: CF-Talk
Subject: RE: Create table ID field

Here's an example for an Access table, where the primary key is an
autonumber field, and there's a separate index as well.

<cfquery
datasource="#request.blahblah#">
CREATE TABLE myfile (
  ID COUNTER not NULL PRIMARY KEY,
  ParentID number NULL,
  LinkID number NULL,
  Slot number NULL ,
  ItemType text(10) NULL
);
</cfquery>
<cfquery
datasource="#request.blahblah#">
CREATE INDEX ParentID on myfile(ParentID);
</cfquery>

--------------------------------------------
Matt Robertson       [EMAIL PROTECTED]
MSB Designs, Inc.    http://mysecretbase.com
--------------------------------------------
  _____
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to