Then you must be using SQL Server, not Access, as that syntax wouldn't work in Access!  Perhaps you've got an Access project with a SQL Server database as the back end, or perhaps you're using the MSDE.
 
Bob
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Erik Fenkell
Sent: Tuesday, 5 March 2002 9:17 a.m.
To: [EMAIL PROTECTED]
Subject: RE: [CFTALKTor] AUTO_INCREMENT

That was it. Thanks very much.
 
Erik
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Bob Silverberg
Sent: Monday, March 04, 2002 3:14 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFTALKTor] AUTO_INCREMENT

It looks like you're using SQL Server, if so, the syntax is:
 
<cfquery name="create_table" datasource="xx_renters">
 
CREATE TABLE user (
     user_id      INTEGER IDENTITY(1,1)  NOT NULL PRIMARY KEY,
     user_name    VARCHAR (20)     NOT NULL,
     password     VARCHAR (20)     NOT NULL
     )
</cfquery>
 
 It's the IDENTITY keyword that makes it an "Autonumber" field.  The (1,1) means that the numbering should start at 1 and increment in steps of 1.
 
Bob
 
 -----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Erik Fenkell
Sent: Tuesday, 5 March 2002 8:35 a.m.
To: [EMAIL PROTECTED]
Subject: [CFTALKTor] AUTO_INCREMENT

Hello All,
 
I am trying to create a table whose primary key AutoIncrements. Creating the table is not a problem, making the primary key auto increment is.
 
Here is the query.
 
-------------------------
<cfquery name="create_table" datasource="xx_renters">
 
CREATE TABLE user (
     user_id      INTEGER          NOT NULL PRIMARY KEY,
     user_name    VARCHAR (20)     NOT NULL,
     password     VARCHAR (20)     NOT NULL,
     UNIQUE (user_id)
     )
</cfquery>
------------------------
 
I have tried all means of syntax for autoincrement but with no luck.
 
Thanks for any advice.
 
Best,
Erik

Reply via email to