其中主要的代码部分,要设置一个全局变量  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

最后SourceFileName的结果是类似于这个样子的:
'File3.dat';'';'123';

按照SQL联机手册的解释,三个' ' 之间的内容依次是
文件名,目录,文件大小;

object.SourceFilename [= 'name';'path';'size';'name';'path';'size'; ...]


Posted on 2004-11-08 08:37  Jason's WMI SQL Related Blog  阅读(1262)  评论(0编辑  收藏  举报