Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Count the row using Script Task

Author  Topic 

abhijaiswal.84
Starting Member

29 Posts

Posted - 2012-08-20 : 02:42:25
Hi All,

I need your help, in my project I need to get the count from .csv file using script task, discription as below.

I need to used a script task which will use either vb.net code or C#.net code. The script task should take the count from a .csv (flat file) and return the count to a variable.

Can anyone please help me out, its really very much needed to me. Please help me out if anyone can give me a code for this.

Thanks in advance.

Abhishek

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-20 : 11:08:06
when you say count do you mean rowcount? if yes, parse the file contents using an array and declare a counter. inside loop iterate through each row and increment counter. at the end return counter value in a variable which will give you rowcount

if you ask me easiest way is to use a data flow task with flatfile source for csv and use rowcount transform to get value onto a variable rather than using script task

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

abhijaiswal.84
Starting Member

29 Posts

Posted - 2012-08-20 : 11:30:10
Yes its rowcount, but as I said in my original post the project requirment is using script task that to either with VB.Net or C#.Net

Abhishek
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-20 : 17:13:33
ok..good luck then!

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -