Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 meta-data

Author  Topic 

priyaram
Yak Posting Veteran

82 Posts

Posted - 2007-05-07 : 14:30:15
how can we extract metadata for a database tables.

do we have any sql's for that??

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-07 : 14:38:29
What kind of metadata you want?

To some extent, INFORMATION_SCHEMA views can help. But it is really impossible to tell unless we know exactly what you want.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

priyaram
Yak Posting Veteran

82 Posts

Posted - 2007-05-07 : 14:41:29
SELECT T.TABLE_NAME AS [Table], C.COLUMN_NAME AS [Column],
C.IS_NULLABLE AS [Allows Nulls?], C.DATA_TYPE AS [Type]
FROM INFORMATION_SCHEMA.Tables T
JOIN INFORMATION_SCHEMA.Columns C
ON T.TABLE_NAME = C.TABLE_NAME
WHERE T.TABLE_NAME NOT LIKE 'sys%'
AND T.TABLE_NAME <> 'dtproperties'
AND T.TABLE_SCHEMA <> 'INFORMATION_SCHEMA'
ORDER BY T.TABLE_NAME, C.ORDINAL_POSITION


, some thing like this
Go to Top of Page
   

- Advertisement -