MS SQL server Meata data question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Jones

    MS SQL server Meata data question

    I need to use php's native mssql api in order to read the meta data from an
    entire DBMS ... I have sql server 2000 up and running and using the provided
    browsing tools poked around and found that the databases in the system were
    listed under a database named "master" in a table named "sysdatabas es" ...
    there is a "syscolumns " table there too but it looks like i need specific
    info about the architecture of sql server's inner workings to use it.

    the native php support for sql server doesn't have meta data functions like
    are provided for things like mysql and odbc. I can't use adodb or pear for
    alot of reasons ...

    can anyone help me or point me to a souce for how to get:

    databases -- I have done this one in a round about way
    tables in those databases
    attributes in those tables
    and attribute types

    I need to do this for Oracle too but I think the native support for Oracle
    is better and the tools built in ... I think Oracle supports something they
    call show commands that just do what I want.

    Thanks
    Tom


  • Andy Hassall

    #2
    Re: MS SQL server Meata data question

    On Mon, 12 Jan 2004 18:32:36 -0500, "Tom Jones" <tomjones@lucen t.com> wrote:
    [color=blue]
    >I need to do this for Oracle too but I think the native support for Oracle
    >is better and the tools built in ... I think Oracle supports something they
    >call show commands that just do what I want.[/color]

    No idea about SQL Server, never used it. However, in Oracle, you look in the
    'data dictionary' for metadata; it's a set of views such as USER_TABLES,
    USER_TAB_COLUMN S that you query with ordinary SQL.

    See: http://otn.oracle.com/pls/db92/db92....emark=homepage

    'SHOW' commands are for MySQL - such as 'SHOW TABLES'. You can execute these
    as queries and they return a result set, but they're not proper SQL as you
    can't have WHERE clauses or use them in joins etc.

    --
    Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
    <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>

    Comment

    • Jochen Daum

      #3
      Re: MS SQL server Meata data question

      Hi Tom!
      On Mon, 12 Jan 2004 18:32:36 -0500, "Tom Jones" <tomjones@lucen t.com>
      wrote:
      [color=blue]
      >I need to use php's native mssql api in order to read the meta data from an
      >entire DBMS ... I have sql server 2000 up and running and using the provided
      >browsing tools poked around and found that the databases in the system were
      >listed under a database named "master" in a table named "sysdatabas es" ...
      >there is a "syscolumns " table there too but it looks like i need specific
      >info about the architecture of sql server's inner workings to use it.
      >
      >the native php support for sql server doesn't have meta data functions like
      >are provided for things like mysql and odbc. I can't use adodb or pear for
      >alot of reasons ...
      >
      >can anyone help me or point me to a souce for how to get:
      >
      >databases -- I have done this one in a round about way
      >tables in those databases
      >attributes in those tables
      >and attribute types
      >
      >I need to do this for Oracle too but I think the native support for Oracle
      >is better and the tools built in ... I think Oracle supports something they
      >call show commands that just do what I want.[/color]

      Check out the INFORMATION_SCH EMA_* Views, which are well explained in
      the MSSQL documentation (BOL). Thats what I use...

      HTH,Jochen


      [color=blue]
      >[/color]



      [color=blue]
      >Thanks
      >Tom
      >[/color]

      --
      Jochen Daum - CANS Ltd.
      PHP DB Edit Toolkit -- PHP scripts for building
      database editing interfaces.
      Download PHP DB Edit Toolkit for free. PHP DB Edit Toolkit is a set of PHP classes makes the generation of database edit interfaces easier and faster. The main class builds tabular and form views based on a data dictionary and takes over handling of insert/update/delete and user input.

      Comment

      • Chung Leong

        #4
        Re: MS SQL server Meata data question

        Call the store procedure sp_databases and sp_tables to get a list of
        databases and tables (in the current database). sp_columns will get your a
        list of a table's columns. Look in your MS SQL help file for more info.

        Uzytkownik "Tom Jones" <tomjones@lucen t.com> napisal w wiadomosci
        news:btvarb$9sb @netnews.proxy. lucent.com...[color=blue]
        > I need to use php's native mssql api in order to read the meta data from[/color]
        an[color=blue]
        > entire DBMS ... I have sql server 2000 up and running and using the[/color]
        provided[color=blue]
        > browsing tools poked around and found that the databases in the system[/color]
        were[color=blue]
        > listed under a database named "master" in a table named "sysdatabas es" ...
        > there is a "syscolumns " table there too but it looks like i need specific
        > info about the architecture of sql server's inner workings to use it.
        >
        > the native php support for sql server doesn't have meta data functions[/color]
        like[color=blue]
        > are provided for things like mysql and odbc. I can't use adodb or pear[/color]
        for[color=blue]
        > alot of reasons ...
        >
        > can anyone help me or point me to a souce for how to get:
        >
        > databases -- I have done this one in a round about way
        > tables in those databases
        > attributes in those tables
        > and attribute types
        >
        > I need to do this for Oracle too but I think the native support for Oracle
        > is better and the tools built in ... I think Oracle supports something[/color]
        they[color=blue]
        > call show commands that just do what I want.
        >
        > Thanks
        > Tom
        >
        >[/color]


        Comment

        Working...