How do I look at column metadata in Sybase?

后端 未结 3 624
庸人自扰
庸人自扰 2021-01-12 10:37

I have a list of columns a co-worker has given to me, but these columns reside in different tables in the DB. Is there some kind of tool in Sybase where I can query the tabl

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-12 11:28

    syscolumns holds column metadata.

    select * from syscolumns where name = ;

    The id column in syscolumns is the id of the column's table, in sysobjects;

    select b.name as tablename, a.name as columnname
    from syscolumns a join systables b on (a.id = b.id) 
    where b.type='U' and b.name = 'foo';
    

    gets all columns for the table named 'foo'. The type = 'U' limits it to user tables.

    select b.name as tablename, a.name as columnname
    from syscolumns a join systables b on (a.id = b.id) 
    where b.type='U' and a.name = 'foo';
    

    gets all columns named 'foo'.

    Most current version of ASE will use sysbojects instead of systables

提交回复
热议问题