Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

table and column listing 1

Status
Not open for further replies.

dbadmin

Programmer
Jan 3, 2003
147
US
Hi,

How could I get a listing of all tables and its columns from a database in SQL Server 2000/

dbadmin
 
information_schema.tables
information_schema.columns

using ado and openschema

sysobjects
syscolumns

dmo



======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Hi,

I figured out. I did it using sysobjects and syscolumns.

Thanks for the help.

dbadmin
 
Thought I'd add this little bit to the thread:

using sysobjects and syscolumns will work fine, but if MS changes the format of the tables in the next version of SQL Server you may have a chore in porting your code.

INFORMATION_SCHEMA.Tables and INFORMATION_SCHEMA.Columns are views of the same data, but the format of the tables is supposed to remain the same regardless of what MS does to the system tables.

Therefore, it is generally advisable to use the INFORMATION_SCHEMA views instead of the system tables.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top