Solved

Export Table Names to Excel from SQL Server

Posted on 2015-02-15
8
562 Views
Last Modified: 2015-02-15
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
Comment
Question by:SpaceCoastLife
  • 3
  • 3
  • 2
8 Comments
 
LVL 1

Expert Comment

by:hi4ppl
ID: 40610867
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
 

Author Comment

by:SpaceCoastLife
ID: 40610888
The query works great but can you tell me more about how I export the result to Excel?
0
 
LVL 12

Expert Comment

by:Jeff Darling
ID: 40610899
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:SpaceCoastLife
ID: 40610903
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
 
LVL 12

Expert Comment

by:Jeff Darling
ID: 40610906
0
 
LVL 1

Accepted Solution

by:
hi4ppl earned 500 total points
ID: 40610911
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
 
LVL 12

Expert Comment

by:Jeff Darling
ID: 40610919
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
 

Author Closing Comment

by:SpaceCoastLife
ID: 40610926
Got it! Thanks for the help.
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question