Creating an SSIS package to generate an XML output file

  • I have created a SSIS package to generate an XML output file. The package run without any errors. The problem I am having is when I go to open the XML file it has all these crazy looking characters instead of the data that it should have.

    In my Data Flow I am using a OLE DB Source with sql command. The script run fine, returning the data that I'm looking for when I run it in a query.

    I have a Data Conversion for the input column and output alias with data type unicode text stream [DT_NText]. When I try and change the data type to anything else I get the red x on the flat file destination.

    I am using a flat file destinations, mapping is correct.

    I am not sure what is wrong. Can someone please help me out.

    Thank you,

    Kevin

  • Your XML document may be malformed. Are you sure you have your hierarchy designed correctly?

    And are you looking for a full XML document or just a fragment?

    EDIT: Are you changing data types on the Connection Manager or in the Data Flow Task?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • The Hierarchy design is correct as far as I can see.

    The Data type is the same in the connection manager and in the Data Conversion Transformation Editior.

    I'm looking for a full XML document.

  • kbnyny (4/16/2014)


    The Data type is the same in the connection manager and in the Data Conversion Transformation Editior.

    That's not what I asked. You said you were having problems changing the data type. I'm asking you where you are trying to change the data type that you're getting this problem.

    Usually, the change should be made in the Connection Manager first. Then the object(s) in the Data Flow task have to be refreshed (open, then click on Column Mappings, then close the Transformation) to "take" the metadata changes. That clears up any warnings or errors. This may need to be done for multiple objects, depending on if you're changing the source or the destination data.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • kbnyny (4/16/2014)


    I have created a SSIS package to generate an XML output file. The package run without any errors. The problem I am having is when I go to open the XML file it has all these crazy looking characters instead of the data that it should have.

    In my Data Flow I am using a OLE DB Source with sql command. The script run fine, returning the data that I'm looking for when I run it in a query.

    I have a Data Conversion for the input column and output alias with data type unicode text stream [DT_NText]. When I try and change the data type to anything else I get the red x on the flat file destination.

    I am using a flat file destinations, mapping is correct.

    I am not sure what is wrong. Can someone please help me out.

    Thank you,

    Kevin

    Any chance you can share the query that generates the XML?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Here is the query that I am using

    SELECT DISTINCT TOP 10

    PLastName

    ,PFirstName

    ,PBorough

    ,PState

    ,PZip5

    ,PIdentificationType

    ,PIssuedBy

    ,SCity

    ,SState

    ,InspectionDate

    ,InspectionTime

    FROM vwECB

    FOR XML RAW('MOV')

    ,ROOT('ECBXML')

    ,elements

    ,BINARY BASE64;

  • Sorry Brandie, I did not make myself clear enough. I can change the data type but the problem is when I do change it to anything beside Unicode text stream [DT_NTEXT] I get a red x on the flat file destination.

  • kbnyny (4/16/2014)


    Sorry Brandie, I did not make myself clear enough. I can change the data type but the problem is when I do change it to anything beside Unicode text stream [DT_NTEXT] I get a red x on the flat file destination.

    If you hover over the destination, what is the error message that you get?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • right now there is no error because I have the data type set as Unicode text stream [DT_NTEXT]

  • kbnyny (4/16/2014)


    right now there is no error because I have the data type set as Unicode text stream [DT_NTEXT]

    What is the encoding of the flat file? ANSI, UTF-8 or unicode? Check in the connection manager.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • In connection Manager the encoding is Unicode

  • OK. If you put a data viewer right before you write to the destination, does the data look normal?

    When the flat file is created, can you double check the encoding using a decent text editor, like notepad++?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • kbnyny (4/16/2014)


    Sorry Brandie, I did not make myself clear enough. I can change the data type but the problem is when I do change it to anything beside Unicode text stream [DT_NTEXT] I get a red x on the flat file destination.

    Again, you're not telling me WHICH component you're making the change on that gets the file destination screwed up. There are multiple components that MUST be changed. Are you changing all of them or only one of them?

    Do this:

    Change the connection manager data type. The flat file destination should get a red X. Open the flat file destination, click on the Column Mappings tab, then (after it finishes changing over) hit OK.

    Does the red X go away? If not, open up the Error tab and paste the contents into this thread. Do not "fix" it back until Koen and I can get an idea of what's going wrong.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Here is a screen shot of the error, not sure if this will work.

  • kbnyny (4/16/2014)


    Here is a screen shot of the error, not sure if this will work.

    You cannot post directly from your own hard drive.

    You can upload an image as an attachment though. (but not as PDF)

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 15 posts - 1 through 15 (of 31 total)

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