2008年4月7日 星期一
2008年3月20日 星期四
在DTS中使用Activex 工作處理檔案--Copy
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dim fs,strfullpath,f
set fs=createobject("Scripting.FileSystemObject")
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim f2
dim yyymm
Set f2 = fs.OpenTextFile("D:\SKBANK\BISsys\DATA\lnctbfy.dat", ForReading, True)
yyymm = f2.Read(5)
'Main=DTSTaskExecResult_Failure
fs.CopyFile "D:\SKBANK\BISsys\DATA\lnctbfy.dat", "D:\SKBANK\BISsys\DATA\"+yyymm+"lnctbfy.dat"
set fs=nothing
Main=DTSTaskExecResult_Success
End Function
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dim fs,strfullpath,f
set fs=createobject("Scripting.FileSystemObject")
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim f2
dim yyymm
Set f2 = fs.OpenTextFile("D:\SKBANK\BISsys\DATA\lnctbfy.dat", ForReading, True)
yyymm = f2.Read(5)
'Main=DTSTaskExecResult_Failure
fs.CopyFile "D:\SKBANK\BISsys\DATA\lnctbfy.dat", "D:\SKBANK\BISsys\DATA\"+yyymm+"lnctbfy.dat"
set fs=nothing
Main=DTSTaskExecResult_Success
End Function
在DTS中使用Activex 工作處理檔案
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dim fs,strfullpath,f
set fs=createobject("Scripting.FileSystemObject")
if (fs Is Nothing) then
Main=DTSTaskExecResult_Failure
'msgbox "1"
exit function
end if
strfullpath="D:\SFBAFK\BISsys\DATA\lnctbtt.dat"
if not fs.fileexists(strfullpath) then
Main=DTSTaskExecResult_Failure
'msgbox "2"
set fs=nothing
exit function
end if
Set f = fs.GetFile(strfullpath)
if f.size =0 then
Main=DTSTaskExecResult_Failure
'msgbox ""
set fs=nothing
exit function
end if
set fs=nothing
'msgbox "4"
'Main=DTSTaskExecResult_Failure
Main=DTSTaskExecResult_Success
End Function
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dim fs,strfullpath,f
set fs=createobject("Scripting.FileSystemObject")
if (fs Is Nothing) then
Main=DTSTaskExecResult_Failure
'msgbox "1"
exit function
end if
strfullpath="D:\SFBAFK\BISsys\DATA\lnctbtt.dat"
if not fs.fileexists(strfullpath) then
Main=DTSTaskExecResult_Failure
'msgbox "2"
set fs=nothing
exit function
end if
Set f = fs.GetFile(strfullpath)
if f.size =0 then
Main=DTSTaskExecResult_Failure
'msgbox ""
set fs=nothing
exit function
end if
set fs=nothing
'msgbox "4"
'Main=DTSTaskExecResult_Failure
Main=DTSTaskExecResult_Success
End Function
在DTS中使用Active 工作執行DTS
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dtsname="ImportBISTwd"
usrname="sa"
servername="MA03XXBXX"
pwd="sapwd"
DTSSQLStgFlag_Default2=0
dim objDTSPackage
dim objDTSStep
dim strResult
dim blnSucceeded
const DTSSQLStgFlag_Default = 0
const DTSStepExecResult_Failure = 1
set objDTSPackage = CreateObject("DTS.Package")
objDTSPackage.LoadFromSQLServer servername, usrname, pwd, DTSSQLStgFlag_Default2, "", "", "", dtsname
objDTSPackage.Execute
Main = DTSTaskExecResult_Success
End Function
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
dtsname="ImportBISTwd"
usrname="sa"
servername="MA03XXBXX"
pwd="sapwd"
DTSSQLStgFlag_Default2=0
dim objDTSPackage
dim objDTSStep
dim strResult
dim blnSucceeded
const DTSSQLStgFlag_Default = 0
const DTSStepExecResult_Failure = 1
set objDTSPackage = CreateObject("DTS.Package")
objDTSPackage.LoadFromSQLServer servername, usrname, pwd, DTSSQLStgFlag_Default2, "", "", "", dtsname
objDTSPackage.Execute
Main = DTSTaskExecResult_Success
End Function
訂閱:
文章 (Atom)