Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    2

    Unanswered: Field and Table structure information

    I am creating a datadictionary for a large database, and I need to be able to read through all of the tables and pull the Field Name, Size, Type, etc from each field in each table

    What is the SQL Command to do this in Sybase? In Ms SQL I would have used:

    "SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH FROM INFORMATION_SCHEMA.COLUMNS"

    Thanks for your help!

  2. #2
    Join Date
    Jun 2006
    Posts
    2
    Never mind. For the next person who needs it:

    Fill a datatable with your list of tables:

    Select ID, NAME from dbo.SysObjects WHERE Type='U'

    Then for each row in the datatable:

    Select * from dbo.syscolumns WHERE ID= <the id from the datatable containing the Name and ID's>

    Now you have all of the information for each field in each table

  3. #3
    Join Date
    Jan 2003
    Location
    Geneva, Switzerland
    Posts
    353
    You should probably also take the object owner into account, so you should join with the sysusers table using the UID column.

    Michael

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •