Wednesday, March 7, 2012

Getting list of database table names, columns, etc?

Is there a way using MS SQL Server and Enterprise Manager to get a text
document (or perhaps even a Word document) listing all table names,
column names, etc of a database?
--
Sugapablo
--
http://www.sugapablo.com <--music
http://www.sugapablo.net <--personalNo, but you can query the system views like INFORMATION_SCHEMA.TABLES and
INFORMATION_SCHEMA.COLUMNSto get a list of all tables and their columns. You
could probably use the query from DTS to create a text document.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm
"Sugapablo" <russREMOVE@.sugapablo.com> wrote in message
news:vmu9gbqqkhfd84@.corp.supernews.com...
Is there a way using MS SQL Server and Enterprise Manager to get a text
document (or perhaps even a Word document) listing all table names,
column names, etc of a database?
--
Sugapablo
--
http://www.sugapablo.com <--music
http://www.sugapablo.net <--personal|||Narayana Vyas Kondreddi wrote:
> No, but you can query the system views like INFORMATION_SCHEMA.TABLES and
> INFORMATION_SCHEMA.COLUMNSto get a list of all tables and their columns. You
> could probably use the query from DTS to create a text document.
Well that sucks. :)
What I did was to dump the SQL into a .sql file (you know, listing the
CREATE TABLE commands).
Everything is there, it just looks real ugly.
I'm surprised MS SQL doesn't have this simple function, like
PostgreSQL's "/d *".
--
Sugapablo
--
http://www.sugapablo.com <--music
http://www.sugapablo.net <--personal|||Looks like you scripted the tables. But your original mail says, you wanted
to get a list of table and column names, which can be accomplished with the
following query:
SELECT TABLE_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
ORDER BY TABLE_NAME, COLUMN_NAME
The results can be directly saved as a text file, from within Query
Analyzer.
What you are asking for is not really the function of a database engine.
It's more of an application thing and there are a lot of third party
database documentation tools out there. One example: fmsinc.com
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm
"Sugapablo" <russREMOVE@.sugapablo.com> wrote in message
news:vmubrmo29o44ca@.corp.supernews.com...
Narayana Vyas Kondreddi wrote:
> No, but you can query the system views like INFORMATION_SCHEMA.TABLES and
> INFORMATION_SCHEMA.COLUMNSto get a list of all tables and their columns.
You
> could probably use the query from DTS to create a text document.
Well that sucks. :)
What I did was to dump the SQL into a .sql file (you know, listing the
CREATE TABLE commands).
Everything is there, it just looks real ugly.
I'm surprised MS SQL doesn't have this simple function, like
PostgreSQL's "/d *".
--
Sugapablo
--
http://www.sugapablo.com <--music
http://www.sugapablo.net <--personal

No comments:

Post a Comment