HELP NEEDED IMMEDIATELY

  • My boss asked me to create a document containing all the tables and all the fields within the tables and their datatypes in a database.There more thn 50 tables so it is inefficient to look up each table individually.I am sure there must be some way this can be done.

    Can any of you SQL GURU's help me with this sticky problem.

    thanks

  • i got what you are looking for;

    there was a script submission that someone made; It creates an HTML document, which you just save and view.

    I've enhanced it slightly, and you can download it here:

    http://www.stormrage.com/blogpix/db_documentation_in_html_script_enhanced.txt

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Here is a starting point: BOL (Books On-Line).

    Lookup the following:

    sys.databases

    sys.tables

    sys.columns

    sys.types

  • just realized that script does not handle things like varchar(max) gracefully.

    here is a link to a 2005 version:

    db_documentation_in_html_script_enhanced2005.txt

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell, thank you for your quick reply.

    Unfortunately I cannot open up the script you attached .Can you paste the entire code in the post.

    thanks

  • check the first link again, I re-edited it; the second link should be fine as well. they just open as a text file; the script is beyond the size limit for possting; it's thousands of lines.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Lowell,Thank you very much.I got what i was looking for and more.:D

  • Hello,

    Just look at this, if this make more sense ....

    SELECT A.name 'TableName', B.name 'ColumnName', C.name + ' ( '+

    CASE WHEN B.length = -1 THEN 'MAX' ELSE CONVERT(VARCHAR(10), B.length) END + ' )' 'DataType'

    FROM sysobjects A, syscolumns B, systypes C

    WHERE A.name = OBJECT_NAME(B.id) and B.xtype = c.xtype and A.xtype = 'u'

    Hope it helps,

    Imran.

  • Thank you Imran.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply