Search code examples
syntaxsap-aseauto-increment

Autoincrement syntax error


The Sybase manual and plenty of examples claim I can write:

   create table run_log (
     run_id        integer not null default autoincrement
   );

But Sybase 15 says there is a syntax error on the default


Solution

  • Sybase documentation isn't great, and it turns out there's Sybase ASA, some other product they bought, and Sybase ASE (Server Enterprise) which is what most people would think of as Sybase.

    For ASE15, it's not autoincrement, it's identity, which must be on numeric, not integer

    create table run_log (
      runid    numeric(12,0) identity
    )