Inconsistent behavior from DTS Package.execute command.

  • I have a DTS package that calls another package on the same server.  The external package executes if the object is created and executed prior to a subsequent call to create a file system object.  If placed after the the creation of the file system object no error is returned but the second package does not give the desired results. 

    The second package executes a stored procedure that uses xp_smtp_sendmail to send a mail.  No parameters are being passed yet.  Success is the email being sent.  When it fails no email is sent.

    Does any one have any thoughts that may help me dig into this problem?

    The following code works

    sServer = "(local)"

    sUID = ""

    sPWD = ""

    iSecurity = DTSSQLStgFlag_UseTrustedConnection

    Set objPackage = CreateObject("DTS.Package")

    objPackage.LoadFromSQLServer sServer,sUID,sPWD,iSecurity,,,,"Comment Report -- Send Mail"

    objPackage.execute()

    objPackage.unInitialize

    Set objPackage = Nothing

    ''const OUTPUT_FILE = "d:\salesreport.txt"

    set objFSO = CreateObject("Scripting.FileSystemObject")

    set objFile = objFSO.CreateTextFile("d:\salesreport.txt" ,8,True)

     

    The following does not work.

    const OUTPUT_FILE = "d:\salesreport.txt"

    set objFSO = CreateObject("Scripting.FileSystemObject")

    set objFile = objFSO.CreateTextFile(OUTPUT_FILE,8,True)

    strDate = "For the week ending " & Date()

    sServer = "(local)"

    sUID = ""

    sPWD = ""

    iSecurity = DTSSQLStgFlag_UseTrustedConnection

    Set objPackage = CreateObject("DTS.Package")

    objPackage.LoadFromSQLServer sServer,sUID,sPWD,iSecurity,,,,"Comment Report -- Send Mail"

    objPackage.execute()

    objPackage.unInitialize

    Set objPackage = Nothing

     

    Thanks,

    Nick

  • Thanks to all that looked at this. Now that I found the answer I realize there was no way anyone could have addressed this. The issue was that both packages were trying to open the same file at the same time. Once I figured out how to find the log files I found the problem.

    Nick

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply