SSIS Exporting to CSV and Opening File in CSV

  • Hi ,
    In SQL DB-  We do have a column ID, which is more than 12 digits length (EX: 854597754782).
    Created process to export to csv file ( Delimited - ")  and it iscausing issue while opening in excel file - issue is number format (ID contains + Symbol 8545+54782).
    To handle this converted ID to varchar(100) and added CHAR(9) - it is displaying correctly in excel but end of ID some space is exists .
    Due to limitations we can't directly to csv, is there any way to handle this situation?

    Hope it is clear, if any questions please let me know

    Thanks,
    Koti.

  • koti.raavi - Thursday, December 6, 2018 9:14 AM

    Hi ,
    In SQL DB-  We do have a column ID, which is more than 12 digits length (EX: 854597754782).
    Created process to export to csv file ( Delimited - ")  and it iscausing issue while opening in excel file - issue is number format (ID contains + Symbol 8545+54782).
    To handle this converted ID to varchar(100) and added CHAR(9) - it is displaying correctly in excel but end of ID some space is exists .
    Due to limitations we can't directly to csv, is there any way to handle this situation?

    Hope it is clear, if any questions please let me know

    Thanks,
    Koti.

    Can you take Excel out of the equation (because it tends to mess with your data) and open the file in Notepad++ instead?

    Then do a View/Show Symbol/Show All Characters to see whether anything has been added.

    Also, why would you need to add a CHAR(9) to anything? Please provide more detail about that.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • koti.raavi - Thursday, December 6, 2018 9:14 AM

    Due to limitations we can't directly to csv, is there any way to handle this situation?

    From this - it appears that you want to get this output to a CSV file.  If so - what are the so-called limitations you are running into with going directly to CSV from SSIS?  Probably a lot less time and effort to address those limitations than to worry about issues with exporting from SSIS to Excel.

    Phil Parkin - Thursday, December 6, 2018 10:31 AM

    Also, why would you need to add a CHAR(9) to anything? Please provide more detail about that.

    Phil - if you add a CHAR(9) to the beginning of a field in Excel it forces that field to be interpreted as a text field and not a numeric field, but that is only when the data in imported into Excel from a comma/tab delimited file.  If SSIS is exporting directly to Excel - then you should be able to define the column types in the Excel 'table' as specific data types.

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • Phil - if you add a CHAR(9) to the beginning of a field in Excel it forces that field to be interpreted as a text field and not a numeric field, but that is only when the data in imported into Excel from a comma/tab delimited file. If SSIS is exporting directly to Excel - then you should be able to define the column types in the Excel 'table' as specific data types.

    Ah, makes sense, thank you.

    The OP suggested that the CHAR(9) was 'added' – made it sound like it was appended to the column, rather than being spliced in at the beginning.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Correct Jeff, I don't want to export to excel due to CSV is much faster than Excel exporting. It's not one file to open and format data in excel. We are exporting around 400 files to CSV everyday and user will open in excel. It is exporting correctly when we add CHAR(9) to column but the issue is with Space .

    Here is the space example:
    current output : "854597754782 "
    desired output : "854597754782"
    Let me know any questions.

    Thanks for you're help

    Thanks,
    Koti.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply