SSIS Help

  • Hi Guys,

    Here is my question.

    I am creating a Flat File through SSIS, Preaty simple package

    Source = Excel

    Transformation = Using some transformation

    Destination = Flat File

    Here I want Header and Footer should be Total Numbers of Records + GET DATE + *******************************************************

    I know How I can get Total Number of records through Variable and use Count Transformation. My question is how I can || (Concatenate) @NumbersOfRecord||GETDATE()||*********************************

    Please advise.

    Thank You,

  • There's no simple way of doing this in the dataflow.

    One way I might do this is to create the basic flatfile as you seem to know how to do, without the header and footer.

    I would then use a script task to create a new file in which I would insert the Header, followed by the content of the file mentioned above, followed by the footer. The original flatfile can now be deleted.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Alvin Ramard (8/26/2014)


    I would then use a script task to create a new file in which I would insert the Header, followed by the content of the file mentioned above, followed by the footer. The original flatfile can now be deleted.

    Or just modify the existing flat file.

    There are plenty of scripts on the web that show you how to add a line to the start or end of a flat file.

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

  • Thank You all for reply.

    I am sorry, I think it was my mistake didn't explain you what I need.

    I know how to create Flat file Plus

    I know how to add Custom header and footer on flat file.

    My question was, My customer Header and footer was Total Count.I am getting this value through Variable. I want to know How I can add with Variable as an example

    Total Count:- 00000026 8/27/2014 ****************************************************************** (This should be my header)

    Flat file Data...........

    ............................

    Total Count:- 00000026 8/27/2014 ****************************************************************** (This should be my footer)

    Thank You.

  • The same solution still stands: you write your data to the flat file. Meanwhile, you store the row count in a variable.

    In the next step, you add the header and footer using a script task that reads the SSIS variable.

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

  • First In your SSIS package you are going to save you row count into variable (for example vartotal).

    Then when you open the script task editor, in the script section you see four items

    1)Script Langauge

    2)Entry Point

    3)ReadOnlyVariables

    4)ReadWriteVariables

    In the readonlyvariables you need to select the variable vartotal

    In the next step when you click on the Edit Script, you are going to use this varaiable with the code

    string count = Dts.Variables["vartotal"].Value.ToString()

  • Thank you all again,

    I get that far, the problem I am getting in Script Task I can easy add My Total count variable value and its working fine. I want to know How i can add with Count Variable + Getdate + ************************

    so my header and footer would be

    Count Varaible + Getdate + *************************

    Any advise.

    Thank You.

  • DateTime.Now Property

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

  • Hi,

    In C: drive i have many folders .

    For example folders named like ABC,ARD,AVB,BGT,BHT etc...And these folders has many subfolders and files in it.

    My Task is to search for a string (For example : TASC) in all these folders and sub folders.

    I have a for loop container and a script task to do this.But since the data that is found under C: is huge the package runs for more than 1 day.So i thought of splitting this task and do a parallel execution.

    I.e.; I can replicate this Forloop container task 23 times(A-Z) and run it parallely.That is one container will look for the main folders(ABC,ARD,AVB) starting with A and another container task will look for

    main folders starting with B (BGT,BHT) .similarly i will replicate this container task .All these containers will execute parallely when i run the package.This will take only few hours to complete. i need to achieve this.Can someone help me on this ?

    Any help is much appreciated.

    Thanks

    Nisha V Krishnan

  • nishav2 (9/4/2014)


    Hi,

    In C: drive i have many folders .

    For example folders named like ABC,ARD,AVB,BGT,BHT etc...And these folders has many subfolders and files in it.

    My Task is to search for a string (For example : TASC) in all these folders and sub folders.

    I have a for loop container and a script task to do this.But since the data that is found under C: is huge the package runs for more than 1 day.So i thought of splitting this task and do a parallel execution.

    I.e.; I can replicate this Forloop container task 23 times(A-Z) and run it parallely.That is one container will look for the main folders(ABC,ARD,AVB) starting with A and another container task will look for

    main folders starting with B (BGT,BHT) .similarly i will replicate this container task .All these containers will execute parallely when i run the package.This will take only few hours to complete. i need to achieve this.Can someone help me on this ?

    Any help is much appreciated.

    Thanks

    Nisha V Krishnan

    Please start a new thread with your question, instead of hijacking an existing one.

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

Viewing 10 posts - 1 through 9 (of 9 total)

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