开发者

SSIS 2005 - How to get the timestamp properties for a file

开发者 https://www.devze.com 2022-12-25 18:04 出处:网络
How do you get a timestam开发者_高级运维p from a file with SQL Server Intergration Services 2005?You\'ll have to use a script task, something along these lines should do the trick:

How do you get a timestam开发者_高级运维p from a file with SQL Server Intergration Services 2005?


You'll have to use a script task, something along these lines should do the trick:

    Dim filePath As String = "C:\YourFolder\YourFile.ext"

    If File.Exists(filePath) = False Then
        Dts.TaskResult = Dts.Results.Failure
        Return
    End If

    Dim currentDate As Date = DateTime.Now
    Dim fileCreateDate As Date = File.GetCreationTime(path)

    If currentDate.ToShortDateString <> fileCreateDate.ToShortDateString Then
        'Do something
    End If


You can use the open-source File Properties Task to get and/or set any one of the three timestamps on a file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号