2012年3月22日星期四

Flat File Destination

Hi,

How can I check if my Flat File Destinatino is empty or not?

I′m sending it with FTP, but I don′t wanna send an empty file.

Any ideas?

Thank you.

I reckon you coudl use a WMI query to get this, but to be honest I don't know how.

I would use the Script Task, just write a quick line of VB to grab the file size and stuff it in a variable. If being good you could read the filename straight off the file connection as well, e.g.

Code Snippet

Dim fileInfo As System.IO.FileInfo = New System.IO.FileInfo(Dts.Connections("Flat File Conn").ConnectionString)

Dts.Variables("FileSize").Value = fileInfo.Length

Note I created a variable called FileSize of Int64, and added it to ReadWriteVariables list of my Script Task.

Next, I would use an expression on the constraint leading from the script task to the ftp task. @.[User::FileSize] > 0, such that the expression must be satisfied to run the FTP task.

没有评论:

发表评论