?
Solved

lost header when export to csv file from sql server

Posted on 2011-04-20
8
Medium Priority
?
616 Views
Last Modified: 2012-05-11
Hi Expert,

When I export to csv file from sql server 2008 resoult pane, it lost header, how to solve the problem. I right click on result pane and select to 'save results as' csv file.

Thanks in advance.

0
Comment
Question by:dshi15
  • 3
  • 3
  • 2
8 Comments
 
LVL 1

Author Comment

by:dshi15
ID: 35436200
this is the longest header in result pane. Q2NonTireMotorcraftTestedToughBattery
0
 
LVL 1

Author Comment

by:dshi15
ID: 35436209
and column header no space and no "_" , no special characters.
0
 
LVL 2

Expert Comment

by:SQLSergentMike
ID: 35436263
SSMS options-->query results-->SQL server--> resultstogrid-->check include headers
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
LVL 2

Accepted Solution

by:
roshnipatel earned 1000 total points
ID: 35436273
In MS SQL Server Mgmt Studio,
go to the Query Menu -> Query Options

Under Results:
Select TEXT

Check "Include Column headers in the result set"

*You may also need to update the Maximum Number of characters displayed in each column Query Options Screen
0
 
LVL 1

Author Comment

by:dshi15
ID: 35436423
Hi roshnipatel, I had same you showed, but still not come out.
0
 
LVL 2

Expert Comment

by:roshnipatel
ID: 35436516
Then you should go to Query -> Results To -> results to text.
Re-execute your query.

You'll be prompted to select a file location.  If you choose .rpt, once the query has ran, change the file extention to .csv

You should have the headers that way
0
 
LVL 2

Expert Comment

by:SQLSergentMike
ID: 35436612
Because it's results to grid like I indicated earlier, thats the default so I assume thats what your doing.
0
 
LVL 2

Assisted Solution

by:SQLSergentMike
SQLSergentMike earned 1000 total points
ID: 35436653
Like this... like this like this
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

Ready to get certified? Check out some courses that help you prepare for third-party exams.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
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…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Suggested Courses

809 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