Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    20

    Unanswered: SQL to get column types of a table?

    Hi,

    I have looked through various posts as well as hunted for a DB2 data dictionary but still can' t find the solution in basic SQL. Can someone even point me at
    the data dictionary as I couldn't find it on the IBM site.

    I can do this in Oracle, Teradata, Sybase and SQL Server but I'm fairly new to DB2.

    Thanks in advance.

    Cheers,
    Daniel.

  2. #2
    Join Date
    Feb 2004
    Posts
    20
    I think I'm getting close with:

    select name, tbname, coltype, length, scale from sysibm.syscolumns where tbname = <mytable>

    I also should have said earlier that I'm running DB2 8.1 on Windows 2003 and connecting from solaris.

  3. #3
    Join Date
    Feb 2002
    Location
    Philippines
    Posts
    41
    how about:

    DESCRIBE TABLE <tablename>

    is that what you need?
    There are 10 kinds of people,
    those who know binary and those who don't.

    http://www.linkedin.com/in/rtitong

  4. #4
    Join Date
    Feb 2002
    Location
    Philippines
    Posts
    41
    Quote Originally Posted by danielbrowne
    I think I'm getting close with:

    select name, tbname, coltype, length, scale from sysibm.syscolumns where tbname = <mytable>

    I also should have said earlier that I'm running DB2 8.1 on Windows 2003 and connecting from solaris.
    yup... using a select statement, that should be what you
    There are 10 kinds of people,
    those who know binary and those who don't.

    http://www.linkedin.com/in/rtitong

  5. #5
    Join Date
    Feb 2004
    Posts
    20

    Thumbs up

    Thanks guys. I opted for the "select..." option as I'm using unixODBC's 'isql'.

    thanks.

Posting Permissions

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