How to Use DTS of SQL 2000 to automatically download files from the FTP server

Source: Internet
Author: User

The mainCodeTo set a global variable dtsglobalvariables ("Sourcefilename")

' **************************************** ******************************
' Visual Basic ActiveX script
' **************************************** ********************************
Option   Explicit

Function Main ()
Createfile
Main = Dtstaskexecresult_success
End Function

Sub Createfile ()
Dim Todaydate, stringt
Dim Mymonth, myday
If   Month ( Date ) < 10   Then
Mymonth = " 0 "   &   Month ( Date )
Else
Mymonth = Month ( Date )
End   If
If   Day ( Date ) < 10   Then
Myday = " 0 "   &   Day ( Date )
Else
Myday = Day ( Date )
End   If
Stringt =   " ABC "   &   Year ( Date ) & Mymonth & Myday &   " . Txt "  
Dtsglobalvariables ( " Sourcefilename " ). Value = CHR (39) & stringt & CHR (39) & CHR (59) & CHR (39) & CHR (39) & CHR (59) & CHR (39) & CHR (39) & CHR (59)
Msgbox Dtsglobalvariables ( " Sourcefilename " ). Value
End sub

The final result of sourcefilename is similar to this:
'File3. dat '; ''; '123 ';

According to the SQL online manual, the content between the three ''is
File Name, directory, and file size;

Object.Sourcefilename[='Name';'Path';'Size';'Name';'Path';'Size';...]


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.