Results 1 to 6 of 6

Thread: Table structure

  1. #1
    Join Date
    Jul 2004
    Posts
    5

    Unanswered: Table structure

    How can I get the structure of a table?
    With MySql I can do it this way: DESC | DESCRIBE <tablename>

    Thank you,

    Dirk
    Dirk.Ulrich@gmx.de

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    sp_help table_name
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Jul 2004
    Posts
    5
    I get the message how many data records have been changed but not the table's structure telling me which column is of which datatapye, length, ...

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Are you sure? Run it again, you might have missed something
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Jul 2004
    Posts
    5
    Well, I have installed a program called WinLine and from its administration panel I am able to execute SQL statements. When I submit sp_help t025imp the message window displays how many rows have been affected but the table's structure is not changed.
    Maybe the application does not display the original message. Since a MSDE was installed during setup I don't have a SQL console or something like that to execute the command you told me.
    Do you have a quick Java-solution to print out the DB result?

  6. #6
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Replace all occurences of 'dbo.authors' with the your table name:

    select
    'Column_name' = name,
    'Type' = type_name(xusertype),
    'Length' = convert(int, length),
    'TrimTrailingBlanks' = case ColumnProperty(object_id('dbo.authors'), name, 'UsesAnsiTrim')
    when 1 then 'NO'
    when 0 then 'YES'
    else '(n/a)' end,
    'FixedLenNullInSource' = case
    when type_name(xtype) not in ('varbinary','varchar','binary','char')
    Then '(n/a)'
    When status & 0x20 = 0 Then 'NO'
    Else 'YES' END,
    'Collation' = collation
    from syscolumns where id = object_id('dbo.authors') and number = 0 order by colid
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

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