Results 1 to 6 of 6

Thread: get database information

  1. #1

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    get database information

    Hi guys

    A long shot, maybe, but is there any way that I can get details of all of the tables in a database by running a query?

    The problem is this: I use an informix database hosted by a third party. They're happy for me to access however they're not very forthcoming with any sort of database design information so I don't know which columns are in which tables.

    I know that if it were a sqlserver database I could run sp_help to get this sort of information however is there any query I can run in asp or vb that will give me this information?

    ps, I've connected using ado.

    Tar!
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: get database information

    You could loop through all the tables using Adox (if they've installed it) and output to the screen. Then loop through the columns on each table (listing under the table name?).

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: get database information

    Er, ok.....how do I go about this?!
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

  4. #4
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    Re: get database information

    This article might help.

    As far as ADOX goes, you'll need a reference to msadox.dll (Microsoft ADO Ext. 2.8 for DDL and Security) and you can get all sorts of schema info.
    However, ADOX was designed and built for Access, so other DBMS are patchily supported. There are loads of posts in this forum about how best to use it.

  5. #5
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: get database information

    thebloke,

    Open the database using ADO and try this:

    VB Code:
    1. Dim dbSchema as ADODB.Recordset
    2.           Dim i as Integer
    3.  
    4.           Set dbSchema = New ADODB.Recordset
    5.           dbSchema = db.OpenSchema(adSchemaTables, Array(Empty, Empty, Empty, "TABLE"))
    6.  
    7.            For i = 0 to dbSchema.Fields.Count - 1
    8.                 Debug.Print dbSchema.Fields(i)
    9.            Next i
    Enumerate through the fields property for the names of the columns.
    Last edited by randem; Apr 28th, 2005 at 03:42 AM.

  6. #6

    Thread Starter
    Hyperactive Member thebloke's Avatar
    Join Date
    May 2003
    Posts
    358

    Re: get database information

    I'll give it a go. Tar.
    The Bloke
    www.blokeinthekitchen.com
    making cooking cool for blokes

Posting Permissions

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



Click Here to Expand Forum to Full Width