Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to write a query to get table & field names

Author  Topic 

sbt1
Yak Posting Veteran

89 Posts

Posted - 2003-09-26 : 14:51:22
Is it possible to write a query to return:
1 - the names of the database tables in a given database, as text
2 - the names of the fields of a given database table, as text

?

Thx for any help in advance.

X002548
Not Just a Number

15586 Posts

Posted - 2003-09-26 : 15:30:18
Sure...
go to Books online and look up INFORMATION_SCHEMA.Tables and INFORMATION_SCHEMA.Columns

What do you mean by text though?

Do you want to create a text file?

Cut and Paste from QA won't do?

You can create a view and bcp it out?

HTH





Brett

8-)

SELECT @@POST FROM Brain ORDER BY NewId()

That's correct! It's an AlphaNumeric!
Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2003-09-26 : 15:36:12
And here's an article we wrote about this.

http://www.sqlteam.com/item.asp?ItemID=13122

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -