SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Flat file record count inside script task


Flat file record count inside script task

Author
Message
aveerabadran
aveerabadran
SSC-Enthusiastic
SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)

Group: General Forum Members
Points: 109 Visits: 291
Hi All,

I have a requirement where , i need to get number of records present in the flat file . i need to achive this inside a script task . Can anyone help on this?

Thanks
Arun
KenpoDBA
KenpoDBA
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1046 Visits: 620
Well, I find it weird that the requirement actually includes doing it in a script task because normally requirements don't care how you get it done as long as the end result is met. However... as for counting the rows in that flatfile, you'll have to move them somewhere and for each row send it to a script task where you just increment a local var for each row that passes. It's actually pretty easy.

However, if the script is only going to count the rows, then you're better off going the easy route and putting a rowcount task between the file and its destination.

Watch my free SQL Server Tutorials at:
http://MidnightDBA.com
Blog Author of:
DBA Rant – http://www.MidnightDBA.com/DBARant

Minion Maintenance is FREE:


aveerabadran
aveerabadran
SSC-Enthusiastic
SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)SSC-Enthusiastic (109 reputation)

Group: General Forum Members
Points: 109 Visits: 291
crever , thanks for the reply.

can u let me know the transformation where row count is possible (other than script task) , and can u also outline how to do it?

i need this rowcount to be stored in a variable/somewhere , since i need to do some processing inside the script task based on this.

Thanks,
Arun
KenpoDBA
KenpoDBA
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1046 Visits: 620
I have a video on how to use the rowcount.

http://midnightdba.itbookworm.com/SSISRowCount/SSISRowCount.html

Watch my free SQL Server Tutorials at:
http://MidnightDBA.com
Blog Author of:
DBA Rant – http://www.MidnightDBA.com/DBARant

Minion Maintenance is FREE:


SrikanthSv
SrikanthSv
SSC-Enthusiastic
SSC-Enthusiastic (115 reputation)SSC-Enthusiastic (115 reputation)SSC-Enthusiastic (115 reputation)SSC-Enthusiastic (115 reputation)SSC-Enthusiastic (115 reputation)SSC-Enthusiastic (115 reputation)SSC-Enthusiastic (115 reputation)SSC-Enthusiastic (115 reputation)

Group: General Forum Members
Points: 115 Visits: 112
Add a Flat File Source and Pass the rows to a row count transformation.
This should do the job.

Regards
Venkat
http://sqlblogging.blogspot.com
Robert Mosley-431040
Robert Mosley-431040
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 14
I am having problems using the count rows task.
What I want to do is use a FOR EACH LOOP to get the name of the files. Then use a SQL Task to put the row counts in a SQL table. The files would be ragged right. The connection object doesn't like having an expression for the connection string.

I have no problem if I hard code one file name and run it.

Could someone help me with this?
J-440512
J-440512
Right there with Babe
Right there with Babe (717 reputation)Right there with Babe (717 reputation)Right there with Babe (717 reputation)Right there with Babe (717 reputation)Right there with Babe (717 reputation)Right there with Babe (717 reputation)Right there with Babe (717 reputation)Right there with Babe (717 reputation)

Group: General Forum Members
Points: 717 Visits: 949
To get the name of files in a directory, I suggest you review this article:

Accessing the Windows File System from SQL Server
Written By: Edgewood Solutions Engineers -- 6/12/2007

http://www.mssqltips.com/tip.asp?tip=1263

Problem
Within my SQL Server T-SQL stored procedures and scripts I need to find out the files in a specific directory. What are some approaches to do so? I need some flexibility to capture the file names and general information for subsequent processing. What are the native SQL Server options as well as the custom options that are available?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search