Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sorry, am in a hurry, here is the snapshots n the scripts, hopefully it helps.</p> <p>This package is scanning a folder for files conforming your specs, then pass the control to a Data Flow.</p> <p><a href="http://img395.imageshack.us/img395/8531/dynafilecontrolflowms9.jpg" rel="nofollow noreferrer">alt text http://img395.imageshack.us/img395/8531/dynafilecontrolflowms9.jpg</a></p> <p>Control Flow, <a href="http://img395.imageshack.us/img395/8531/dynafilecontrolflowms9.jpg" rel="nofollow noreferrer">http://img395.imageshack.us/img395/8531/dynafilecontrolflowms9.jpg</a></p> <p><a href="http://img104.imageshack.us/img104/2010/dynafileforeachij5.jpg" rel="nofollow noreferrer">alt text http://img104.imageshack.us/img104/2010/dynafileforeachij5.jpg</a></p> <p>For Each Loop Properties, <a href="http://img104.imageshack.us/img104/2010/dynafileforeachij5.jpg" rel="nofollow noreferrer">http://img104.imageshack.us/img104/2010/dynafileforeachij5.jpg</a></p> <p><a href="http://img164.imageshack.us/img164/7614/dynafilefilesystemyj1.jpg" rel="nofollow noreferrer">alt text http://img164.imageshack.us/img164/7614/dynafilefilesystemyj1.jpg</a></p> <p>File System Properties, <a href="http://img164.imageshack.us/img164/7614/dynafilefilesystemyj1.jpg" rel="nofollow noreferrer">http://img164.imageshack.us/img164/7614/dynafilefilesystemyj1.jpg</a></p> <pre><code>Imports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Runtime Imports System.IO Public Class ScriptMain Public Sub Main() Dim Ext As String = ".txt" Dim Path As String = ".\" 'must get from package variable to be more dynamic Dim FileNames() As String = Directory.GetFiles(Path, "CC*" + Ext, SearchOption.TopDirectoryOnly) Dim ValidFileNames As New Collection For Each FileName As String In FileNames Dim FileDate As String = FileName.Substring(Len(Path) + 2) 'first 2 letter is already "CC" If Not IsYmd(FileDate.Substring(0, Len(FileDate) - Len(Ext))) Then Continue For ValidFileNames.Add(FileName) Next Dts.Variables("FileNames").Value = ValidFileNames Dts.TaskResult = Dts.Results.Success End Sub Private Function IsYmd(ByVal Test As String) As Boolean If Len(Test) &lt;&gt; 6 Then Return False Dim Year As String = Left(Test, 2) Try If CStr(2000 + CInt(Year)) &lt;&gt; "20" + Year Then Return False Catch ex As Exception Return False End Try Dim Month As String = Mid(Test, 3, 2) Try If CInt(Month) &lt; 1 Then Return False If CInt(Month) &gt; 12 Then Return False Catch ex As Exception Return False End Try Dim Day As String = Right(Test, 2) Dim FirstOfMonth As String = "20" + Year + "/" + Month + "/01" Dim EndOfMonth As Integer = DateAndTime.Day(DateAndTime.DateAdd(DateInterval.Day, -1, _ DateAndTime.DateAdd(DateInterval.Month, 1, CDate(FirstOfMonth)))) Try If CInt(Day) &lt; 1 Then Return False If CInt(Day) &gt; EndOfMonth Then Return False Catch ex As Exception Return False End Try Return True End Function End Class </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload