Case study 16: Index syntax
  • Platform: HP-UNIX 11, Tru64 , Windows
  • Sybase ASE version: 12.5.x
  • Background story: I do not know why, but I really have a problem remembering create and drop index syntax. So I'll put it here where I can easily find it.
  • Task: Write a syntax reletated to index
  • Solution: There is simple create index syntax:

    create index index_name on table_name (column_name1, column_name2)

    and there is drop index syntax:

    drop index table_name.index_name

  • Remark: Full create and drop index syntax are given below. For more information about index (and other Sybase) commands, look at Reference Manual Volume 2:Commands.

    create [unique] [clustered | nonclustered]
    index index_name
    on [[database.]owner.]table_name
    (column_name [asc | desc]
    [, column_name [asc | desc]]...)
    [with { fillfactor = pct,
    max_rows_per_page = num_rows,
    reservepagegap = num_pages,
    consumers = x, ignore_dup_key, sorted_data,
    [ignore_dup_row | allow_dup_row],
    statistics using num_steps values } ]
    [on segment_name]

    drop index table_name.index_name [, table_name.index_name] ...
   
  powered by myself. DBA-Sybase 2006