[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

sql export to csv and have column names

Posted on 2010-01-05
6
Medium Priority
?
287 Views
Last Modified: 2012-05-08
select * from firstname
select * from lastname

save query as .csv

and open .csv file and see column names 'firstname' and 'lastname'  using microsoft excel
0
Comment
Question by:rgb192
  • 2
  • 2
  • 2
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 26183430
are  firstname  nad lastnames are your tablenames ?
0
 
LVL 26

Accepted Solution

by:
tigin44 earned 2000 total points
ID: 26183457
go to tools > options and navigate to the part in the picture... There is an option about including column headers... check it.  restart your managment studio and rerun your query. save the results... now you have the column headers.
editorOptions.jpg
0
 

Author Comment

by:rgb192
ID: 26183459
yes
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 26183477
try the above posted by Tigin
0
 
LVL 26

Expert Comment

by:tigin44
ID: 26183507
so your query should be like this

SELECT  firstname, lastname
FROM yourTableName
0
 

Author Closing Comment

by:rgb192
ID: 31673098
thansk
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

834 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