ASP Code to generate the schema of an SQL Table (field name, Data types , Size)

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default ASP Code to generate the schema of an SQL Table (field name, Data types , Size)

    Anyone has this SQL STATEMENT to traverse the User defined tables?

    I just need the Select Statement to get this info the rest I can handle.

    I am not interested is revealing the system table information just my
    created tables schema.

    Psuedo code like as follows:

    dim cn ' ADOVBS.Connection
    dim rsUserTableNames ' ADOVBS.Recordset
    dim vTable ' variant
    dim fldUserTableFieldNames ' ADOVBS.Fields
    dim vFld ' variant

    Set cn =
    Server.CreateObject("ADODB.Connection")
    Set rsUserTableNames =
    Server.CreateObject("ADODB.Recordset")

    Set cn = CreateObject( I don't
    need this)

    Set rsUserTableNames = CreateObject( "I need this SQL
    Statement") <--- SQL STATEMENT to traverse the User defined tables???

    For each vTable in rsUserTableNames
    Response.Write vTableName.Name & <br> & <br> & <br>
    For each vFld in vTableName
    Response.write vFld.Name & <br> & vFld.Type & <br> &
    vFld.Size
    next
    next

    Thank you for your assistance

    Robert H. Weinstein
    Associate Programmer Analyst (Specialist)
    Office of Technology Resources


    Robert Guest

  2. Similar Questions and Discussions

    1. Alter Table / Changing field types in SQL
      Hi Folks - I was wondering if anybody knows of some way to convert a field within a MS SQL table from varchar to Numeric. A table was set up...
    2. schema data types
      hi all, i want to know a small clarification. in the schema data types, there are two data types for handling numeric digits.... what is the...
    3. Trying to generate classes from an XSD schema
      Hi, I'm new to web services so please forgive. For some reason I'm unable to generate classes for the schema...
    4. Disparity between XML Schema types and .Net CLS types
      Hello. The following link lists the mapping of XML Schema types to .Net Framework types:...
    5. How to generate a document from table schema?
      In article <bc503f80.0306270809.50bdb2cd@posting.google.com>, dnlchou@yahoo.com says... I've done that with Sybase PowerDesigner. After 'reverse...
  3. #2

    Default Re: ASP Code to generate the schema of an SQL Table (field name, Data types , Size)

    Robert wrote:
    > Anyone has this SQL STATEMENT to traverse the User defined tables?
    >
    In SQL Server 7 and above, there are a group of Views owned by the
    INFORMATION_SCHEMA login: INFORMATION_SCHEMA.Tables,
    INFORMATION_SCHEMA.Columns, etc. These views contain the information you are
    looking for. You can simply run a query against them to get the needed
    information. See SQL Books Online (BOL) for more information.

    HTH,
    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows Guest

  4. #3

    Default Re: ASP Code to generate the schema of an SQL Table (field name, Data types , Size)

    On Tue, 23 Dec 2003 13:21:36 -0800, "Robert" <nospam@hotmail.com>
    wrote:
    >Anyone has this SQL STATEMENT to traverse the User defined tables?
    Does this help?

    [url]http://www.aspfaq.com/show.asp?id=2178[/url]

    Jeff
    >
    >I just need the Select Statement to get this info the rest I can handle.
    >
    >I am not interested is revealing the system table information just my
    >created tables schema.
    >
    >Psuedo code like as follows:
    >
    > dim cn ' ADOVBS.Connection
    > dim rsUserTableNames ' ADOVBS.Recordset
    > dim vTable ' variant
    > dim fldUserTableFieldNames ' ADOVBS.Fields
    > dim vFld ' variant
    >
    > Set cn =
    >Server.CreateObject("ADODB.Connection")
    > Set rsUserTableNames =
    >Server.CreateObject("ADODB.Recordset")
    >
    > Set cn = CreateObject( I don't
    >need this)
    >
    > Set rsUserTableNames = CreateObject( "I need this SQL
    >Statement") <--- SQL STATEMENT to traverse the User defined tables???
    >
    > For each vTable in rsUserTableNames
    > Response.Write vTableName.Name & <br> & <br> & <br>
    > For each vFld in vTableName
    > Response.write vFld.Name & <br> & vFld.Type & <br> &
    >vFld.Size
    > next
    > next
    >
    >Thank you for your assistance
    >
    >Robert H. Weinstein
    >Associate Programmer Analyst (Specialist)
    >Office of Technology Resources
    >
    Jeff Cochran Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139