Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2002
    Posts
    84

    Question Unanswered: SQL script to show the table definition in MSSQL

    Just like "describe select(*) from table_name" in DB2?

    Thanks!

  2. #2
    Join Date
    Jun 2005
    Posts
    85
    'sp_help table_name' will do.

  3. #3
    Join Date
    Apr 2002
    Posts
    84
    Thanks. but when I keyed in "sp_help tbl_name" in MSSQL2000, it returned an error.

  4. #4
    Join Date
    Nov 2002
    Posts
    272
    Any particular error? I forgot my crystal ball today.

  5. #5
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734

    Talking

    I think I can guess the error. lol

    Try running:

    EXEC sp_help 'sysobjects'

    Now, replace "sysobjects" with your table name. If the table name has spaces, put [] around the name.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  6. #6
    Join Date
    Apr 2002
    Posts
    84
    Thanks. The script is working, but returned me some properties of the table such as user etc.

    What I want is the definitions of all the columns like type and length of char.
    Please help!

  7. #7
    Join Date
    Apr 2002
    Posts
    84
    tried again. it is working. I didn't notice the properties in lower portion of
    the screen.

    sorry for the confussion.

Posting Permissions

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