Help needed with DTS -
05-12-2004
, 08:12 AM
I have a machine with SQL 7 on it, and need to run several queries in a
timed DTS job to create a single text file for input to another system.
The reason I'm having to do this is I have to make more than 1 pass thru the
data in order to create the record types needed on the other system. For
instance, I have to create a bill to and a shipto record in the output. The
info is on a single line in the table, but must be on 2 lines in the output
text file.
One thing I need to do is to pass a parameter into each of the stored
procedures, so they have a single date and a single time in each of them. I
think I know how to do that piece of it, by putting the variables in a SQL
query in the Transform Data Task properties and then passing that parameter
into each stored procedure I call there.
First question:
I know I can create a single text file by dragging a Microsoft OLE DB
Provider for SQL onto the DTS screen, and a single text file there, and then
put the sql code in the Transformation of it. My question is though, if I
pull a specific date & time stamp that needs to be on ALL records of Each
file, how can I pass those parameters to the next and the next and the next
transformations?
Second question:
Combining the files into a single text output file. I have an ActiveX
Script Task sitting in the DTS that's supposed to put the files together
using a DOS copy command. The code follows:
Function Main()
dim pkg
dim cus
dim strCmdLine
set pkg = DTSGlobalVariables.Parent
set cus = pkg.Tasks("CreateProcessTask").Customtask
'Build the commandline string
strCmdLine = "copy test1.txt+test2.txt+test3.txt+test4.txt+test6.txt
test5.txt /Y"
' & _ DTSGlobalVariables("gv_strTextFilename").Value
'assign it to the ProcessCommandline property
cus.ProcessCommandLine = strCmdLine
'Assign our success return code
cus.SuccessReturnCode = DTSGlobalVariables("gv_i_SuccessCode").Value
'How long do we want to wait for the process to finish ?
cus.Timeout = DTSGlobalVariables("gv_i_Timeout").Value
'If we reach our timeout value should we terminate the process ?
cus.TerminateProcessAfterTimeout = _
DTSGlobalVariables("gv_b_TermAfterTimeout").Value
'Clean up
set pkg = nothing
Main = DTSTaskExecResult_Success
End Function
However, the code above fails when I attempt to run it. The error message
gives me a "Task 'CreateProcessTask' was not found." message. I do not know
what's wrong with this. I know the copy command itself is not an issue, as
it works fine from a command prompt.
Any help on either of the two above problems would be appreciated.
Thanks,
SC |