developer155
Programmer
What is the way to transfer query results (held in a Object variable) into a file on a network?
thanks!
thanks!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Function Main()
On Error Resume Next
Dim strRecord
Dim objFso
Dim objStream
Dim objResults
'path to your output file, change it to a UNC path if you need to
const OUTPUT_FILE = "D:\Shared\FileDump\Logs1.txt"
const FSOFORWRITING = 2
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objResults = DTSGlobalVariables("GlobalVarialbeNameThatHoldsTheResultSet").Value
Set objStream = objFso.CreateTextFile(OUTPUT_FILE, FSOFORWRITING, 2)
While Not objResults.EOF
strRecord = objResults("field1") & "|" & objResults("field2") & "|" & objResults("field3") & "|" & objResults("field4")
objStream.WriteLine(strRecord)
objResults.MoveNext
Wend
objResults.Close
objStream.Close
Set objStream = Nothing
Set objFso = Nothing
Set objResults = Nothing
If Err.Count = 0 Then
Main = DTSTaskExecResult_Success
Else
Main = DTSTaskExecResult_Failure
End If
End Function