Solved

SQL Select Databases information

Posted on 2012-04-12
3
184 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 37839993
In SQL you can use

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

to get info about tables/columns in each user database
0
 
LVL 40

Accepted Solution

by:
lcohan earned 500 total points
ID: 37840018
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
 

Author Closing Comment

by:lrbrister
ID: 37857109
Thanks
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question