I use this code all of the time.  I have changed some of the documentation
on this code so that you will know what is going on.

<CFOBJECT TYPE="COM" NAME="objDTS" CLASS="DTS.Package" ACTION="CREATE">

There are 3 primary locations DTS packages are generally loaded from:

>From SQL Server, from Storage File, or from repository.  There are 3
different primary
methods that can be executed, one for each of these DTS locations.

LoadFromSQLServer Syntax:

ObjectName.LoadFromSQLServer("ServerName",
                "ServerUserName",
                "ServerPassword",
                "Flags",
                "PackagePassword",
                "PackageGuid",
                "PackageVersionGuid",
                "PackageName",
                "pVarPersistStgOfHost")

NOTE: If you want to retrieve the PackageGuid, PackageVersionGuid,
PackageName from the
database, run the "sp_enum_dtspackages" system stored procedure. It returns
the following
variables:

    name, id, versionid, description, createdate, owner, size, packagedata,
isowner


LoadFromStorageFile Syntax:

ObjectName.LoadFromStorageFile("UNCFile",
                "Password",
                "PackageID",
                "VersionID",
                "Name",
                "pVarPersistStgOfHost")


LoadFromRepository Syntax:

ObjectName.LoadFromRepository("RepositoryServerName",
                "RepositoryDatabaseName",
                "RepositoryUserName",
                "RepositoryUserPassword",
                "PackageID",
                "VersionID",
                "PackageName",
                "Flags",
                "pVarPersistStgOfHost")

This is sample code to execute a (SQLServer) DTS from ColdFusion ("objDTS"
is the
Object I created, server is "shorwith", username is "sa" with no password,
"test" is
the name of the DTS):

<CFTRY>
    <CFOBJECT TYPE="COM" NAME="objDTS" CLASS="DTS.Package" ACTION="CREATE">
    <CFCATCH TYPE = "Object">
        <CFSET error_message = "The DTS Package Object Could Not Be
Created.">
    </CFCATCH>
</CFTRY>

<CFTRY>
    <CFSET r =
objDTS.LoadfromSQLServer("SHORWITH","sa","",0,"","","","test","")>
    <CFCATCH>
        <CFSET error_message = "The DTS Package Could Not Be Loaded From the
SQL Server at this time.">
    </CFCATCH>
</CFTRY>

<CFIF IsDefined("error_message")>
    <CFOUTPUT>#error_message#</CFOUTPUT>
</CFIF>

<CFSET p = objDTS.Execute()>


-----Original Message-----
From: Dave Wilson [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 10:07 AM
To: CF-Talk
Subject: RE: executing sql server dts package from cf


Steven,

There are a couple of ways to do this. The first using CFObject is outlined
on cfcomet.com. Antoher way is to run DTS using cfexecute as follows.

<CFSET sArg = "/S servername /U username /P password /N packagename">
<CFEXECUTE name="c:\program files\microsoft sql
server\80\tools\binn\dtsrun.exe" arguments="#sArg#"
outputfile="c:\MyExportLog.txt" timeout="1800"/>

HTH,
Dave

-----Original Message-----
From: Steven Dworman [mailto:[EMAIL PROTECTED]]
Sent: 10 May 2002 15:12
To: CF-Talk
Subject: executing sql server dts package from cf


I've never done this.  Where can I find information?

Thanks,

Steven D Dworman
Macromedia Certified Developer
---------------------------------------------------------
Web Consultant
Systems Administrator

ComSpec International - http://www.comspecinternational.com
phone: 248.647.8841
cell:  248.767.9925
---------------------------------------------------------
EMPOWER-XL ***Software for Higher Education***
http://www.empower-xl.com


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to