Export query results to CSV that includes complext text not being preserved when opening in Excel


  • I am tyring to setup a job that does a few queries and emails the results as an email with a few attachments.

    So far, this part works.  However, the output isnt something that is readily viewable in Excel. 
    The query is hitting sys.dm_exec_query_stats , so one of the columns includes the text of various sql queries in that column.
    Something related to my formatting of the CSV file within the SSIS tasks is causing this.
    When I do the following - Run query in SSMS, copy/paste results into Excel, save as CSV, then re-open in Excel - the results look as expected.  Everything is on seperate lines.

    My settings for the flat file connection manager

    What formatting setting(s) am I missing.

    Monday, July 08, 2013 8:36 PM


  • Well, I figured it out. 

    In the query that returns the column containing sql statements, I put the whole string wrapped with double quotes, then removed the Text qualifier and also had to remove my sample file, and re-create the flat file manager and mappings.  Finally, its working


    If your changing the settings int he flat file manger, and you are keep the name the same, it will pick up the formatting within the existing file and some of the settings will get confused.

    • Edited by shiftbit Monday, July 08, 2013 8:58 PM sdfgsdfg
    • Marked as answer by shiftbit Monday, July 08, 2013 8:58 PM
    Monday, July 08, 2013 8:57 PM