title: SQL query to get primary keys for all tables in sybase ase 15.x along with column names
body: <p>I'm using Sybase ASE 15.5 and a stranger to this database.
  Straight to the point-->
  I'm looking for a sql query that would help me get the primary keys for all tables in sybase along with the column names on which the primary key is declared. 
  For example,
  if I have the following tables,
  organization having primary key PK_org_id on the column org_id
  org_alias having primary key PK_alias_id on the column alias_id
  org_temp having primary key PK_org_temp_id on the columns (org_id,org_name)</p>
  
  <p>then the query should return me with:</p>
  
  <ul>
  <li>Table_Name     PK_Name         Column_name </li>
  <li>Organization   PK_org_id       org_id </li>
  <li>Org_alias      PK_alias_id     alias_id</li>
  <li>Org_temp       PK_org_temp_id  org_id,org_name</li>
  </ul>
  
  <p>I've tried the below query:</p>
  
  <pre><code>select  o.name , i.name
  from   sysobjects  o,   sysindexes   i   
  where o.id=i.id  
  and i.indid = 1  
  and o.type = 'U'
  </code></pre>
  
  <p>but it only returns me the table name with its primary key.
  I want to have the column name too.</p>
  
  <p>Please help!</p>