Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 4th, 2006, 04:07 PM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using System Tables, Views and Stored Procedures

Hey, new to the forms here.

Can anyone give me some good articles or links on using the system tables in SQLExpress? Specificly I'm looking for information reguarding finding how many databases exist along with what tables, stored procedures, triggers, views etc exist within those tables and their column names, types and sizes.

Basicly I need to find out what the column type and size is by using the system tables, views, stored procedures, etc.

I've been experimenting with sys.sysdatabases and that can give me a list of the current databases, but I need to go a level deeper.

Curiously enough I've made 3 test databases. When I select the master database and execute "SELECT * FROM sys.tables"; only the tables from the first database appear and the tables from my other two do not appear in the list. However they'll show once run my query on the appropriate database ("USE Test2"). Any comment on this?

So far I could use "sys.sysdatabases" and filter the system databases to get a list of the user databases, and then use

USE [myDataBase]
GO
SELECT * FROM sys.tables

to get all the tables in that database, but what about selecting the column metadata information? Name, type, size, identity (if any) etc?

Thanks in advance!
 
Old September 4th, 2006, 02:18 PM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hai,

use
SELECT * FROM INFORMATION_SCHEMA.TABLES

 
Old September 6th, 2006, 03:09 AM
Registered User
 
Join Date: Aug 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

use Information_Schema.Columns to get the column metadata.

Code:
Select * from information_schema.columns where table_name = 'sometable'
Harsh Athalye
India
"Nothing is impossible"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't use stored procedures containing temp tables jsandee Reporting Services 1 December 20th, 2007 02:24 PM
system tables and stored procedures recovery prob. mukund SQL Server 2000 1 December 24th, 2004 07:22 PM
Stored Procedures Inside of Views ea SQL Server 2000 3 December 9th, 2004 06:11 PM
Uploading database tables/stored procedures Jan_Ma Classic ASP Databases 2 June 17th, 2003 11:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.