Link to home
Start Free TrialLog in
Avatar of dshi15
dshi15Flag for United States of America

asked on

lost header when export to csv file from sql server

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.

Avatar of dshi15
dshi15
Flag of United States of America image

ASKER

this is the longest header in result pane. Q2NonTireMotorcraftTestedToughBattery
Avatar of dshi15

ASKER

and column header no space and no "_" , no special characters.
SSMS options-->query results-->SQL server--> resultstogrid-->check include headers
ASKER CERTIFIED SOLUTION
Avatar of roshnipatel
roshnipatel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dshi15

ASKER

Hi roshnipatel, I had same you showed, but still not come out.
Avatar of roshnipatel
roshnipatel

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
Because it's results to grid like I indicated earlier, thats the default so I assume thats what your doing.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial