SQL Select Databases information

Is there a select or view that I could get that gets me the following for all NON system databases?

Such as if I had 2 catalogs....busSys and busUsers, I would get JUST the following for those two databases?

databasename     tablename     fieldname     fieldtype     isnull
lrbristerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
lcohanConnect With a Mentor Database AnalystCommented:
For instance code below will list all tables,columns, data type and precision/scale from current db where is executed :

select distinct
      c.id,
      o.name as 'Tname',
      c.name as 'Cname',
      t.name as DataType, c.length, c.xprec, c.xscale, c.isnullable--into #cp_tabless
from sysobjects o, syscolumns c, systypes t
where o.id = c.id and
          c.xtype = t.xtype and
            t.name <> 'sysname' and o.name not like 'sys%' and
        o.type = 'U'  
order by 'cname','tname'
0
 
lcohanDatabase AnalystCommented:
In SQL you can use

select * from sys.tables
select * from sys.columns

to get info about tables/columns in each user database
0
 
lrbristerAuthor Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.