This query has proven to be a useful tool for documenting an unfamiliar database, in a way that may be manipulated via your spreadsheet of choice...
select o.xtype as object_type
, case o.xtype
when 'U' then 'User Table'
when 'V' then 'User View'
when 'S' then 'System Table'
else 'other'
end as object_type_desc
, o.name as table_view_name
, c.name as column_name
, c.xtype as column_type
, ct.name as column_type_name
, c.length as column_length
, c.xprec as column_precision
, c.xscale as column_scale
, case when c.isnullable = 1 then 'Nulls Allowed' else 'Non-Null' end
from sysobjects o
inner join syscolumns c
on o.id = c.id
inner join systypes ct
on c.xtype = ct.xtype
where o.xtype in ('u','v')
order by o.name, c.colid
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.