From a Sybase Database, how I can get table description ( field names and types)?

前端 未结 12 875
刺人心
刺人心 2020-12-07 11:46

I have access to command line isql and I like to get Meta-Data of all the tables of a given database, possibly in a formatted file. How I can achieve that?

Thanks.

12条回答
  •  清歌不尽
    2020-12-07 12:30

    Check sysobjects and syscolumns tables.

    Here is a diagram of Sybase system tables.

    List of all user tables:

    SELECT * FROM sysobjects WHERE type = 'U'
    

    You can change 'U' to other objects:

    • C – computed column
    • D – default
    • F – SQLJ function
    • L – log
    • N – partition condition
    • P – Transact-SQL or SQLJ procedure
    • PR – prepare objects (created by Dynamic SQL)
    • R – rule
    • RI – referential constraint
    • S – system table
    • TR – trigger
    • U – user table
    • V – view
    • XP – extended stored procedure

    List of columns in a table:

    SELECT sc.* 
    FROM syscolumns sc
    INNER JOIN sysobjects so ON sc.id = so.id
    WHERE so.name = 'my_table_name'
    

提交回复
热议问题