Sql Query To Get Primary Keys For All Tables In Sybase Ase 15.x Along With Column Names
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
Solution 1:
Use the built_in function index_col(object_name, indexid, N [,owner_id]).
This lets you retrieve the Nth column of a particular index. Call it multiple times with different values for N, for example by joining it with master..spt_values where type = 'P' and supplying the number column as N.
Solution 2:
If you don't want to code your own query, then look at the catalog procedures that are included with ASE. 'sp_pkeys' should give you what you want.
Post a Comment for "Sql Query To Get Primary Keys For All Tables In Sybase Ase 15.x Along With Column Names"