0

What's wrong with my syntax here? I'm adhering strictly to the rules in the Sybase Reference

CREATE TABLE dashlogactions (
    action_id SMALLINT NOT NULL DEFAULT IDENTITY PRIMARY KEY,
    action_name VARCHAR(64) NOT NULL UNIQUE
)

SQuirrel SQL Client (version 3.3.0) is reporting an error:

Error: Incorrect syntax near the keyword 'DEFAULT'.

SQLState:  ZZZZZ
ErrorCode: 156

Also SQuirrel is showing the words IDENTITY and KEY in red and when I hover over them, it says Invalid ColumnDefault for IDENTITY and EOF expected for KEY.

I get the same results if I replace the word IDENTITY with AUTOINCREMENT.

I'm using Sybase Adaptive Server Enterprise, although I'm not sure of the version.

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Jeremy Goodell
  • 18,225
  • 5
  • 35
  • 52

1 Answers1

1

You need to supply a default value if you use default. See the docs.

Jeff Watkins
  • 6,343
  • 16
  • 19
  • Ah, interesting, I was looking at the docs for Sybase IQ (you can see the hyperlink in my question). Interesting that there would be so much difference between Sybase version syntax. The correct syntax appears to be: action_id SMALLINT IDENTITY NOT NULL PRIMARY KEY -- and the NOT NULL is not required because IDENTITY implies that. Thanks! – Jeremy Goodell Jun 08 '12 at 16:05