Showing posts with label descriptions. Show all posts
Showing posts with label descriptions. Show all posts

Tuesday, March 20, 2012

Retrieving metadata

Hi,

Is it possible to get metadata (i.e. descriptions of tables etc.) in
sql-server? In Oracle you can retrieve this information with tables like
all_objects, user_tables, user_views etc. For example, this query selects
the owner of the table 'ret_ods_test' (in Oracle!):

select owner
from all_objects
where object_name = 'ret_ods_test'

What's the equivalent in sql server?

Thanks a lot.Here are some equivalent queries:

SELECT TABLE_SCHEMA
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME='YourTable'

SELECT USER_NAME(uid)
FROM sysobjects
WHERE name='YourTable'

Razvan|||"Shiva" <gonzo@.shiva.com> wrote in message
news:dcdc2n$2nt$1@.brutus.eur.nl...
> Hi,
> Is it possible to get metadata (i.e. descriptions of tables etc.) in
> sql-server? In Oracle you can retrieve this information with tables like
> all_objects, user_tables, user_views etc. For example, this query selects
> the owner of the table 'ret_ods_test' (in Oracle!):
> select owner
> from all_objects
> where object_name = 'ret_ods_test'
> What's the equivalent in sql server?
> Thanks a lot.

See sp_help, sysobjects, syscolumns, "Meta Data Functions", and the
INFORMATION_SCHEMA views in Books Online.

Simon