470,815 Members | 1,335 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

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 "sysdatabases" ...
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
Jul 17 '05 #1
3 4364
On Mon, 12 Jan 2004 18:32:36 -0500, "Tom Jones" <to******@lucent.com> wrote:
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.


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_COLUMNS 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 <an**@andyh.co.uk> / Space: disk usage analysis tool
<http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>
Jul 17 '05 #2
Hi Tom!
On Mon, 12 Jan 2004 18:32:36 -0500, "Tom Jones" <to******@lucent.com>
wrote:
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 "sysdatabases" ...
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.
Check out the INFORMATION_SCHEMA_* Views, which are well explained in
the MSSQL documentation (BOL). Thats what I use...

HTH,Jochen

Thanks
Tom


--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #3
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" <to******@lucent.com> napisal w wiadomosci
news:bt********@netnews.proxy.lucent.com...
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 "sysdatabases" ...
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

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

26 posts views Thread by David W. Fenton | last post: by
2 posts views Thread by angus | last post: by
3 posts views Thread by datapro01 | last post: by
1 post views Thread by Frank Millman | last post: by
reply views Thread by Macca | last post: by
4 posts views Thread by Engineerik | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.