February 16, 2011 at 1:13 pm
I will be using this script in SSIS packages....Need to convert it
Function Main()
Dim objFSo, strFile, fSize,objSourceFile, BaseFile
Dim ReadAgain
Dim objPackage,oStep
Dim objPackage_2,oStep_2
Set objPackage=CreateObject("DTS.Package")
Set objPackage_2=CreateObject("DTS.Package")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ReadAgain = "No"
objPackage.LoadFromSQLServer "PLSDDTS01", "DTS_crxqhist", "DTS_crxqhist",,,,,"DTS_ASN_XFER_CHILD"
objPackage_2.LoadFromSQLServer "PLSDDTS01", "DTS_crxqhist", "DTS_crxqhist",,,,,"populate_drop_shipment_history"
objPackage.GlobalVariables.Item("ErrorNum").value =0
DTSGlobalVariables("gvCount").Value = DTSGlobalVariables("gvCount").Value + 1
if DTSGlobalVariables("gvCount").Value=1000 Then'
DTSGlobalVariables("gvCount").Value=1
end if
Do
StrFile = DTSGlobalVariables("gvInputDirectory").Value & DTSGlobalVariables("gvInputFile").Value &_
FormatNumber(DTSGlobalVariables("gvCount").Value,0)
For Each oStep in objPackage.Steps
oStep.ExecuteInMainThread=True
Next
For Each oStep_2 in objPackage_2.Steps
oStep_2.ExecuteInMainThread=True
Next
If objFSO.FileExists(strFile) Then
BaseFile = DTSGlobalVariables("gvInputFile").Value & FormatNumber(DTSGlobalVariables("gvCount").Value,0)
Set objSourceFile = objFSO.GetFile( strFile)
fSize = objSourceFile.size
if fSize > 0 Then
objPackage.GlobalVariables.Item("gvBaseFile").value=BaseFile
objPackage.Execute
objPackage_2.Execute
If objPackage.GlobalVariables.Item("ErrorNum").value <> 0 Then
ReadAgain="No"
DTSGlobalVariables("gvCount").Value = DTSGlobalVariables("gvCount").Value - 1
Else
DTSGlobalVariables("gvCount").Value = DTSGlobalVariables("gvCount").Value + 1
if DTSGlobalVariables("gvCount").Value = 1000 Then
DTSGlobalVariables("gvCount").Value=1
End If
ReadAgain = "Yes"
End If
Else
DTSGlobalVariables("gvCount").Value = DTSGlobalVariables("gvCount").Value + 1
ReadAgain = "Yes"
DestFile = DTSGlobalVariables("gvArchiveDirectory").Value &_
Mid(day(date) + 100,2,2) & "\" & BaseFile
End If 'if fSize > 0 Then
Else
DTSGlobalVariables("gvCount").Value = DTSGlobalVariables("gvCount").Value - 1
ReadAgain = "No"
End If
Loop While ReadAgain = "Yes"
If objPackage.GlobalVariables.Item("ErrorNum").value = -1 Then
Main = DTSTaskExecResult_Failure
Else
If objPackage.GlobalVariables.Item("ErrorNum").value = -2 Then
Main = DTSTaskExecResult_Failure
Else
Main = DTSTaskExecResult_Success
End If
End If
Set objFSO = nothing
Set oStep = Nothing
Set oStep_2 = Nothing
objPackage.Uninitialize()
objPackage_2.Uninitialize()
Set objPackage=nothing
Set objPackage_2=nothing
Set objSourceFile=nothing
End Function
February 16, 2011 at 1:29 pm
Is it mandatory to convert to C#, or could you convert it to Vb .Net?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
February 17, 2011 at 8:10 am
C#....thank you
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply