sql export to csv and have column names

select * from firstname
select * from lastname

save query as .csv

and open .csv file and see column names 'firstname' and 'lastname'  using microsoft excel
LVL 1
rgb192Asked:
Who is Participating?
 
tigin44Connect With a Mentor Commented:
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
 
Aneesh RetnakaranDatabase AdministratorCommented:
are  firstname  nad lastnames are your tablenames ?
0
 
rgb192Author Commented:
yes
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Aneesh RetnakaranDatabase AdministratorCommented:
try the above posted by Tigin
0
 
tigin44Commented:
so your query should be like this

SELECT  firstname, lastname
FROM yourTableName
0
 
rgb192Author Commented:
thansk
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.

All Courses

From novice to tech pro — start learning today.