5

How I can find the list of Indexes for a given database in Sybase?

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
aartist
  • 3,145
  • 3
  • 33
  • 31

4 Answers4

8
Query against sysobjects and sysindexes:
SELECT o.name,
       i.name
  FROM sysobjects o
  JOIN sysindexes i
    ON (o.id = i.id)

Documentation on the interpretation of the sysobjects and sysindexes system tables is available on the Sybase web-site.

Load up stored procedure library from http://www.edbarlow.com/ and type in sp__helpindex

or use the Sybase-provided sp_helpindex which expects the table-name as a parameter.

Paul Harrington
  • 772
  • 4
  • 9
2
SELECT Object_name(id)
FROM   sysindexes si
WHERE  indid > 0  
Adi
  • 5,089
  • 6
  • 33
  • 47
deepak11
  • 61
  • 1
1

To get a complete list of indexes in Sybase ASE we can use the following query -

select si.* from sysobjects so, sysindexes si where so.id = si.id and si.indid > 0

keepin in mind that a simple select between sysobjects system table and the sysindexes table will give table names along with index names if non-clustered indexes exists. Check the following link for more information -

Sybase ASE - How to find index list in a sybase database

Neo
  • 142
  • 1
  • 5
Abhinav
  • 11
  • 1
0

In Sybase version SAP IQ/16, you can get list of indexes with following (table name my_table is case-sensitive):

select *
from sys.sysindexes
where tname = 'my_table';

You may check sybase version as follows:

select @@version
Orhan Celik
  • 1,513
  • 15
  • 12