Professional Web Applications Themes

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

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??? ...

  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 yst (Specialist)
    Office of Technology Resources


    Robert Guest

  2. #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

  3. #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" <nospamhotmail.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 yst (Specialist)
    >Office of Technology Resources
    >
    Jeff Cochran Guest

Similar Threads

  1. Alter Table / Changing field types in SQL
    By Fordian-Slip in forum Coldfusion Database Access
    Replies: 2
    Last Post: January 6th, 11:03 PM
  2. schema data types
    By steeban in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: June 4th, 10:00 AM
  3. Trying to generate classes from an XSD schema
    By Craig in forum ASP.NET Web Services
    Replies: 0
    Last Post: May 13th, 11:28 AM
  4. Disparity between XML Schema types and .Net CLS types
    By MikeL in forum ASP.NET Web Services
    Replies: 2
    Last Post: February 22nd, 06:08 AM
  5. How to generate a doent from table schema?
    By Gert van der Kooij in forum IBM DB2
    Replies: 0
    Last Post: June 27th, 05:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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