Tables and Fields dump

Posted on: September 22, 2010 Posted by: John Huh Comments: 0

Tables and Fields dump

Here’s a quick way to see the user tables and fields within a database.
[sourcecode language=”sql”]
select
s.id, s.name as table_name, c.[name] as column_name, t.name as datatype, c.length, c.xprec
from
sysobjects s
inner join syscolumns c
on c.id = s.id
inner join systypes t
on t.xtype = c.xtype
where
s.type = ‘u’
order by
s.name
[/sourcecode]

Leave a Reply:

Your email address will not be published. Required fields are marked *