dbTalk Databases Forums  

Task failed in dts package

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Task failed in dts package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SimplySuzy
 
Posts: n/a

Default Task failed in dts package - 10-03-2006 , 03:49 PM






I have been trying to create an active x script to allow a user to
dynamically create the name of the file by using a dynamically supplied
msgcode, the date and a dynamically filled filename. Here is my code:


Function Main()
'retrieve dynamically set message code
sDB = DTSGlobalVariables("msgCode").value
'set file adendum using month and year
sDate = Month(Now) & Year(Now)
'retrieve file path from global variables, append msgcode and date
creating new file name
sFileName = DTSGlobalVariables("Filepath").value & sDB & "\outgoing\"
& sDB & "_Domestic_" & sDate & ".txt"
Set oConn = DTSGlobalVariables.Parent.Connections("Domestic Mailing")

oConn.DataSource = sFileName
'retrieve file path from global variables, append msgcode and date
creating new file name
sFileName = DTSGlobalVariables("Filepath").value & sDB & "\outgoing\"
& sDB & "_Foreign_" & sDate & ".txt"
Set aConn = DTSGlobalVariables.Parent.Connections("Foreign Mailing")
aConn.DataSource = sFileName
End Function

When I run the package I get the error
"Invalid Task Result Value"

Can anyone see what I am doing wrong???
I have verified all the global variables and they are correct down to
the case of the letters.
Suzy


Reply With Quote
  #2  
Old   
Charles Kangai
 
Posts: n/a

Default RE: Task failed in dts package - 10-04-2006 , 04:40 AM






Hi Suzy,

You must exit the function with some value. Place the following line at the
end of the code:

Main = DTSTaskExecResult_Success

Every code path through your function must return a value for Main.


Charles Kangai, MCT, MCDBA
Author of Learning Tree's 4-day course: "SQL Server 2005 Integration
Services" http://www.learningtree.com/courses/134.htm
Author of Learning Tree's 4-day course: "SQL Server Reporting Services"
http://www.learningtree.com/courses/523.htm
email: charles at kangai.demon.co.uk


"SimplySuzy" wrote:

Quote:
I have been trying to create an active x script to allow a user to
dynamically create the name of the file by using a dynamically supplied
msgcode, the date and a dynamically filled filename. Here is my code:


Function Main()
'retrieve dynamically set message code
sDB = DTSGlobalVariables("msgCode").value
'set file adendum using month and year
sDate = Month(Now) & Year(Now)
'retrieve file path from global variables, append msgcode and date
creating new file name
sFileName = DTSGlobalVariables("Filepath").value & sDB & "\outgoing\"
& sDB & "_Domestic_" & sDate & ".txt"
Set oConn = DTSGlobalVariables.Parent.Connections("Domestic Mailing")

oConn.DataSource = sFileName
'retrieve file path from global variables, append msgcode and date
creating new file name
sFileName = DTSGlobalVariables("Filepath").value & sDB & "\outgoing\"
& sDB & "_Foreign_" & sDate & ".txt"
Set aConn = DTSGlobalVariables.Parent.Connections("Foreign Mailing")
aConn.DataSource = sFileName
End Function

When I run the package I get the error
"Invalid Task Result Value"

Can anyone see what I am doing wrong???
I have verified all the global variables and they are correct down to
the case of the letters.
Suzy



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.