Forum Moderators: open

Message Too Old, No Replies

Autonumber

How do you get it remotly?

         

steelegbr

10:45 am on Jun 7, 2004 (gmt 0)

10+ Year Member



I currently have a database that was ready made by a friend with tables with autonumber columns. I myself do not have a copy of access so use SQL to edit and query the database which is used for a website. I now want to create new tables with autonumber sections, what is the code?

My current SQL command is:

CREATE TABLE newtable1 (review_code AutoNumber, by varchar(255), name varchar(255), review varchar(255), score varchar)

The type AutoNumber doesn't work...

Thanks in advance.

duckhunter

1:43 pm on Jun 7, 2004 (gmt 0)

10+ Year Member



I think you're looking for Identity descriptor.

review_code smallint IDENTITY(1,1) PRIMARY KEY CLUSTERED

steelegbr

3:51 pm on Jun 7, 2004 (gmt 0)

10+ Year Member



When sending the SQL command:

CREATE TABLE newtable1 (review_code smallint IDENTITY(1,1) PRIMARY KEY CLUSTERED, by varchar(255), name varchar(255), review varchar(255), score varchar)

I recieve the error:

Microsoft JET Database Engine error '80040e14'

Syntax error in field definition.

/gosql.asp, line 14

duckhunter

6:15 pm on Jun 7, 2004 (gmt 0)

10+ Year Member



Sorry I misunderstood. Thought you were scripting SQL tables since you didn't have Access. Let's drop the PK & Clustered statements and define it as an int instead of smallint.

Try this:

CREATE TABLE newtable1
(review_code int IDENTITY (1,1),
by varchar(255),
name varchar(255),
review varchar(255),
score varchar(255)
)

steelegbr

3:40 pm on Jun 8, 2004 (gmt 0)

10+ Year Member



Thanks it seemed to work.

CREATE TABLE newtable1 (review_code smallint IDENTITY(1,1) PRIMARY KEY CLUSTERED, [by] varchar(255), name varchar(255), review varchar(255), score varchar)