Link to home
Start Free TrialLog in
Avatar of goldenrule
goldenrule

asked on

simplest query

Hi there,

  just started with sybase. pls tell me how can I get a table's description in sybase?

I know in oracle "describe 'table name'; "   does the job. how about sybase?


Avatar of grant300
grant300

sp_help tablename

Regards,
Bill
ASKER CERTIFIED SOLUTION
Avatar of PegasusAloft
PegasusAloft

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Give this a shot (if not using Sybase Central and ASE):

select A.Table_name, B.column_name,
       (Select domain_name from SYSDOMAIN where domain_id = B.domain_id) as DataType,
        B.width as DataWidth,
       (CASE Pkey
        when 'Y' then 'YES'
        else NULL
        END) as Pkey
from SYSTABLE A, SYSCOLUMN B
where B.table_id = A.table_id and A.Table_Name NOT LIKE ('SYS%')
order by Table_Name, column_id
PegasusAloft
    Err, what version of Sybase are you referring to?  I'm working with ASE 12.5, and there are no objects named SYSTABLE or SYSCOLUMN in any of my databases.  I just peeked.

    This reminds me: There aughtta be a rule that any post contain the Product (ASE, MYSQL, ...) and Version in which the user is working.
Peretz,

ASE, any version, any database, you will find "sysobjects" and "syscolumns".

sysobjects has the tables, views, stored procs, system tables, etc in it.

syscolumns has the columns for tables, views, etc. in it.

This entire discussion is academic anyway.

Just use
sp_help tablename

Bill
sp_help apparently is not supported under either ASA 8 or 9 ("error: Transact-SQL feature not supported).

Just my .02 cents