Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

SSIS Help Expand / Collapse
Author
Message
Posted Tuesday, August 26, 2014 3:05 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 1:46 PM
Points: 219, Visits: 834
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,
Post #1607612
Posted Tuesday, August 26, 2014 3:36 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 3:41 PM
Points: 3,167, Visits: 8,095
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

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.
Post #1607618
Posted Wednesday, August 27, 2014 1:10 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:29 AM
Points: 13,741, Visits: 10,716
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.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1607685
Posted Wednesday, August 27, 2014 8:43 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 1:46 PM
Points: 219, Visits: 834
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.
Post #1607865
Posted Wednesday, August 27, 2014 11:48 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:29 AM
Points: 13,741, Visits: 10,716
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.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1607959
Posted Wednesday, August 27, 2014 12:02 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 2:10 PM
Points: 217, Visits: 580
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()
Post #1607965
Posted Wednesday, August 27, 2014 9:56 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 1:46 PM
Points: 219, Visits: 834
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.

Post #1608121
Posted Thursday, August 28, 2014 12:14 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:29 AM
Points: 13,741, Visits: 10,716
DateTime.Now Property



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1608133
Posted Thursday, September 4, 2014 10:43 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 4, 2014 6:14 PM
Points: 39, Visits: 86
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
Post #1610600
Posted Thursday, September 4, 2014 10:50 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 8:29 AM
Points: 13,741, Visits: 10,716
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.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1610604
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse