Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1608
  • Last Modified:

Export Table Names to Excel from SQL Server

Does anyone know if it's possible to Export Table Names to Excel from SQL Server? I have a Db with several hundred tables and I'd like to capture the names in Excel. Not the properties, just the names. If this can't be done from within SQL Server, perhaps someone can recommend an affordable third party tool?
0
SpaceCoastLife
Asked:
SpaceCoastLife
  • 3
  • 3
  • 2
1 Solution
 
hi4pplCommented:
Hi,

it's possible with only a SQL code...

USE youDatabaseName
SELECT name FROM sys.tables

Open in new window


then export the result of that query to excel simple
0
 
SpaceCoastLifeAuthor Commented:
The query works great but can you tell me more about how I export the result to Excel?
0
 
Jeff DarlingDeveloper AnalystCommented:
you could use a data connection in excel.

under the data tab, then connections, add a connection.

here is a sample of a connection that points to a database and uses SQL.

db connection screenshot
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
SpaceCoastLifeAuthor Commented:
Is that it? Please understand I am neither a sql expert or coder and have no idea how to implement your example. Isn't there a simpler way?
0
 
Jeff DarlingDeveloper AnalystCommented:
0
 
hi4pplCommented:
can you tell me what you are using to run your query? if you are using sql server management studio then do the following

tools -> options -> query results -> SQl Server -> results to text (or grid if you want) -> Include columns headers in the result set

You might need to close and reopen SSMS after changing this option.

* On the SQL Editor Toolbar you can select save to file without having to restart SSMS

and here is a link that show you 2 other way of exporting that query result :D
0
 
Jeff DarlingDeveloper AnalystCommented:
under the data tab is where you setup the data connection,

once have the data connection setup completed, then you can get external data using that connection.

Screenshot showing data tab
click the existing connections button and select the connection.

screenshot showing import dialog
0
 
SpaceCoastLifeAuthor Commented:
Got it! Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now