In MS Sql Server 2005, if you open SSMS (SQL Server management
Studio), in Object Explore under "Views" node for your DataBase,
you can find "System Views". sys.tables keeps information about
your created tables and sys.columns contains info about columns
(Fields) of your tables in the DataBase.
Then to get the columns and data type of them in tables which
have been created in the DataBase, the following code would be
a good example to start and play around it to explore more about
data of the data or the meta data:
select tbl.name as tableName,
clmn.name as columnName,
typ.name as typeName
from sys.columns as clmn
inner join sys.tables tbl
on clmn.object_id = tbl.object_id
inner join sys.types typ
on clmn.system_type_id = typ.system_type_id
order by tbl.name
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment