April 14, 2014 at 8:49 am
Hi,
I need find out the number of columns in flat file before i process that particular file.
I have file name in @filename variable and file path is @filepath variable.
But do not not that how i will check the column name in before i will process that file.
@filePath = C:\Database\SourceFiles\CAHCVSSourceFiles
And i am using for each loop container to read the file one by one and put the file name in @filename variable.
and my file name like
Product_20120607060930.txt
Product_20130708060930.txt
My file structure is:
ID,Name,City,Country,Phone
1,Riya,Pune,India,454564
2,Jiya,New Jersey,India,454564
3,Riya,St Louis,USA,454564
4,Riya,Belleville,USA,454564
5,Riya,Miami,USA,454564
Now what i have to do is i need to make sure that ID,Name,City,County,Phone is there in flat file.
if it is not there then i have to send mail to client saying that file is not valid.
Let me know how i will do it.I need to also calculate the size of flat file.
Thanks,
Unnati
April 14, 2014 at 12:26 pm
You can read the first line using a simple script task, parse it using the delimiter using the String.Split function and count the number of items returned.
You can find the file size using the FileInfo class.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 14, 2014 at 8:07 pm
Hi,
Thanks you very much for your reply but my problem is i can write sql code but i can not write script task(C# Code and VB code)
I really appreciate if you can help me out to resolve this issue.
Thanks,
Unnati
April 14, 2014 at 11:54 pm
unnati.patel513 (4/14/2014)
Hi,Thanks you very much for your reply but my problem is i can write sql code but i can not write script task(C# Code and VB code)
I really appreciate if you can help me out to resolve this issue.
Thanks,
Unnati
You're never too old to learn.
Both MSDN pages I linked to have examples on how to work with the functions.
If you google around, you can find tons of examples on how to read a single line from a text file.
If you want to be proficient in SSIS, you'll have to learn .NET scripting at some point in time.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 16, 2014 at 7:56 am
Thanks you very much for your reply.
You are right eventually i need to learn C# scripting or VB scripting in order to work on SSIS.
Let me know if your have web links for learning C# step by step.
Thanks,
Unnati
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply