Link to home
Start Free TrialLog in
Avatar of keewooi
keewooi

asked on

Sybase 11 - Create a table with AUTOINCREMENT field

Hi,

I want to create a table with an autoincrement field, with the following syntax:

CREATE TABLE auto1
( primary1 INTEGER NOT NULL DEFAULT AUTOINCREMENT,
data1 INTEGER NOT NULL,
PRIMARY KEY ( primary1 ) );

Sybase reports with an error:

Incorrect syntax near the keyword 'DEFAULT'.

I've tried every possible combination, such as removing NOT NULL, DEFAULT, etc.. However, the only way to create the table successfully is to remove the AUTOINCREMENT syntax.

Or is there any option in Sybase to turn off the autoincrement feature?

Anyone can help? Thank you.
ASKER CERTIFIED SOLUTION
Avatar of ahoor
ahoor
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of keewooi
keewooi

ASKER

Thank you so much, it has solved my problem!

Now, can you please tell me, whether or not it's fine to use numeric(10) to replace INT?
Sure it's fine... numeric(10) means you can have numbers up to 9.999.999.999. That's almost 7.000.000.000 more than an integer highest value.
Avatar of keewooi

ASKER

Okay. Thans for the sulution. I appreciate that.