Solved

Export Field Names to Excel for any table in SQL Server

Posted on 2015-02-16
5
77 Views
Last Modified: 2015-02-16
Is there a way to Export Field Names to Excel for any table in SQL Server?
0
Comment
Question by:SpaceCoastLife
[X]
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
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:N R
ID: 40612244
Sure you can, here's a document, step by step.

https://technet.microsoft.com/en-us/library/ms140052%28v=sql.110%29.aspx
0
 
LVL 13

Expert Comment

by:LIONKING
ID: 40612284
What exactly do you plan on doing with the export? Is it something you want to save?

You can easily see all the columns in a table with this query, which you can then copy+paste into Excel.

Query:
SELECT C.name ColumnName
FROM sys.columns C
	INNER JOIN sys.tables T ON
		C.object_id = T.object_id
WHERE T.name = 'MyTableName'

Open in new window

0
 

Author Comment

by:SpaceCoastLife
ID: 40612405
LIONKING: code not working. I get an error on WHERE t.name = "CLIENTS" (or any other table name)
0
 
LVL 13

Accepted Solution

by:
LIONKING earned 500 total points
ID: 40612415
Don't put the quotation symbols, just single quotes.

If the table name is CLIENTS, your query should be:

SELECT C.name ColumnName
FROM sys.columns C
	INNER JOIN sys.tables T ON
		C.object_id = T.object_id
WHERE T.name = 'CLIENTS'

Open in new window

0
 

Author Comment

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

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL 2012 AOG and SQL2014 AOG 76 61
SQL Query Task 11 43
Connect remotely to SQL Server DB without TCP/IP enabled? 2 35
SQL Syntax 6 31
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

749 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