need some quick tips  
Author Message
Aileen





PostPosted: Thu Feb 05 10:15:15 CST 2004 Top

SQL Server Developer >> need some quick tips

what are the t-sql for:

1. list available database on a sql server
2. list the names of tables in a database
3. list the column names of a table
4. list the structure (ie, column definition) of a table

which chapter in Books-OnLine should I read?

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.hide-link.com/
/( _ )\ Linux 2.4.22-xfs
^ ^ 12:00am up 14 days, 32 min, 0 users, load average: 1.13, 1.10,
1.19

SQL Server261  
 
 
David





PostPosted: Thu Feb 05 10:15:15 CST 2004 Top

SQL Server Developer >> need some quick tips Lookup the INFORMATION_SCHEMA views. They give all of this and more.

--
David Portas
SQL Server MVP
--


 
 
toylet





PostPosted: Thu Feb 05 10:27:30 CST 2004 Top

SQL Server Developer >> need some quick tips I found the one about tables and columns. what about database?
here's a snapshot of that chapter:

CHECK_CONSTRAINTS
COLUMN_DOMAIN_USAGE
COLUMN_PRIVILEGES
COLUMNS
CONSTRAINT_COLUMN_USAGE
CONSTRAINT_TABLE_USAGE
DOMAIN_CONSTRAINTS
DOMAINS
KEY_COLUMN_USAGE
REFERENTIAL_CONSTRAINTS
SCHEMATA
TABLE_CONSTRAINTS
TABLE_PRIVILEGES
TABLES
VIEW_COLUMN_USAGE
VIEW_TABLE_USAGE
VIEWS



> Lookup the INFORMATION_SCHEMA views. They give all of this and more.
>

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 12:26am up 14 days, 58 min, 0 users, load average: 1.00, 1.00,
1.07
 
 
toylet





PostPosted: Thu Feb 05 10:31:59 CST 2004 Top

SQL Server Developer >> need some quick tips I found a better place: information stored in system tables

>> Lookup the INFORMATION_SCHEMA views. They give all of this and more.
>>
>

--
.~. Might, Courage, Vision. In Linux We Trust.
/ v \ http://www.linux-sxs.org
/( _ )\ Linux 2.4.22-xfs
^ ^ 12:30am up 14 days, 1:02, 0 users, load average: 1.00, 1.00, 1.04
 
 
David





PostPosted: Thu Feb 05 10:53:27 CST 2004 Top

SQL Server Developer >> need some quick tips SELECT * FROM INFORMATION_SCHEMA.SCHEMATA

--
David Portas
SQL Server MVP
--


 
 
David





PostPosted: Thu Feb 05 10:57:57 CST 2004 Top

SQL Server Developer >> need some quick tips Using the info schema views, system SPs or metadata functions are generally
the preferred ways to access metadata. The data in system tables is not
always in a very accessible form, some features are undocumented and the
tables may be subject to change in future versions.

--
David Portas
SQL Server MVP
--


 
 
vikramj





PostPosted: Wed Feb 18 17:14:30 CST 2004 Top

SQL Server Developer >> need some quick tips
what are the t-sql for:

1. list available database on a sql server

select * from sysdatabases

2. list the names of tables in a database
select * from sysobjects where xtype='U' (for user tables)
or a simple sp_help

3. list the column names of a table
4. list the structure (ie, column definition) of a table

sp_help <tablename> will take care of 3 and 4




Vikram Jayaram
Microsoft, SQL Server

This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.