source text file as input parameter from a stored procedure



Here's my dilemma.

I am using an active X script (data pump) in combination with a global
variable to assign a variable text file name as input to a DTS data
transform task that loads data from a .txt file to a table. Also, I
have a stored procedure wrapper that calls the dts job with a parameter
that it passes in to the global variable.

When I execute the DTS job by itself, I can tell that the data pump is
correctly picking up the global variable and using it as the source
file. In fact, it even writes over the source file name in the data
transform task.

I can also tell that the stored procedure is correctly passing in the
filename. I added a sql task to insert the filename into a table and
it is definitely getting the filename from the paramater in the stored
procedure.

However, the global variable passed in through the stored procedure
DOES NOT get used as the source file for the data transform task. I am
stumped. If anyone has a clue, please let me know.

Thanks -- JG

Here is the activeX script and the relevant stored procedure code:


'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()
Dim oPkg, oDataPump
Dim sSourceTable

Dim iConn
Set iConn = DTSGlobalVariables.Parent.Connections("Connection
1")


iConn.DataSource = DTSGlobalVariables("ipfile").Value

' Get reference to the DataPump Task
Set oPkg = DTSGlobalVariables.Parent
Set oDataPump = oPkg.Tasks("LoadLFDAuthnet").CustomTask

' Set the new values
oDataPump.SourceObjectName = DTSGlobalVariables("ipfile").Value


Set oDataPump = Nothing
Set oPkg = Nothing


Main = DTSTaskExecResult_Success
End Function

EXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUT
if @hr <> 0
BEGIN
print 'error create DTS.Package'
RETURN @hr
END

EXEC @hr = sp_OAMethod @object, 'LoadFromSQLServer', NULL,
@ServerName='xxxx.xxx.org',
@Flags=256,
@PackageName='lfd_authnetDP',
@ServerUserName='xxxx',
IF @hr <> 0
BEGIN
print '*** Load Package Failed'
EXEC sp_OAGeterrorinfo @object, @hr
set @errorString = '*** Load Package Failed'
RETURN @hr
END

EXEC @hr = sp_OASetProperty @object, 'GlobalVariables
("ipfile").value',@inputfile

IF @hr <> 0
BEGIN
print '*** Set Parameter Failed'
EXEC sp_OAGeterrorinfo @object, @hr
set @errorString = '*** Set Parameter failed'
RETURN @hr
END

EXEC @hr = sp_OAMethod @object, 'Execute'
IF @hr <> 0
BEGIN
print '*** Execute failed'
EXEC sp_OAGeterrorinfo @object, @hr
set @errorString = '*** Execute failed'
RETURN @hr
END

EXEC @hr = sp_OADestroy @object
IF @hr <> 0
BEGIN
print '*** Destroy Package failed'
EXEC sp_OAGeterrorinfo @object, @hr
set @ErrorString = '*** Destroy failed'
RETURN @hr
END

.



Relevant Pages

  • how to add table and all its index for replication
    ... If you're talking about code as in stored procedure ... exec sp_addsubscription or exec sp_refreshsubscriptions ... I can script mine out for you and post them up, ... publication and get EM to script out the publications. ...
    (microsoft.public.sqlserver.replication)
  • Re: Help ! how can i use stored procedures return in select statement directly ?
    ... exec sp_serveroption 'Server','data access','true' ... ----If you have a temprary tables within the stored procedure so use ... > I want to write a script like following: ... , then insert into #nameview exec tsp_nameview, because there are too ...
    (microsoft.public.sqlserver.programming)
  • Re: composite key question
    ... Each time you do an insert SQL ... it's probably not a stored procedure. ... queries to perform slower, however. ... Seeing as how that script you sent was not a stored proc, ...
    (microsoft.public.sqlserver.programming)
  • Re: noise words, @@ERROR, and stop and resume indexing
    ... EXEC sp_fulltext_catalog 'adsfull', 'stop' ... > 1) check noise words inside stored procedure ... > can be solved by changing the language specific file with noise words ... ...
    (microsoft.public.sqlserver.fulltext)
  • Re: Repeating 3 Datapump actions between the same datasource/destinati
    ... How to loop through a global variable Rowset ... > exec p_PullDataForDates1 20050101,20050131 ... > task that configure the SourceSQLStatement for the 2 pumps (to fill in the ... > blanks for the stored procedure parameter). ...
    (microsoft.public.sqlserver.dts)