Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Export Microsoft SQL Server Tables and columns into an excel file

Posted on 2016-10-26
3
57 Views
Last Modified: 2016-10-26
I would like to export all the tables and column names of a said database to an excel file. What is the easiest way of going about this ?

Thanks,
Aditya
0
Comment
Question by:giveindia
3 Comments
 
LVL 12

Accepted Solution

by:
Máté Farkas earned 500 total points
ID: 41860089
USE <SaidDatabase>;

SELECT s.name + '.' + t.name AS table_name, c.name AS column_name
FROM sys.tables t
INNER JOIN sys.schemas s on t.schema_id = s.schema_id
INNER JOIN sys.columns c on t.object_id = c.object_id
ORDER BY table_name, column_name

Open in new window

0
 
LVL 48

Expert Comment

by:Vitor Montalvão
ID: 41860092
Use the Import/Export wizard
ExportData.PNG
And when requesting the source query paste the following:
SELECT t.name AS TableName, c.name AS ColumnName
FROM sys.tables t
	INNER JOIN sys.columns c ON c.object_id = t.object_id
ORDER BY t.name, c.column_id

Open in new window

0
 

Author Closing Comment

by:giveindia
ID: 41860178
Thanks that worked great.
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

807 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