Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Vbscript calling DTS package

Reply
 
Old 05-31-2008   #1 (permalink)
research_stuff


 
 

Vbscript calling DTS package

Hi,

I need to call a DTS package from a vbscript. The vbscript can not use
xp_cmdshell to call the DTS package. The vbscript would be scheduled
and executed on the server.

Is there a resource that I can be pointed to for the information?


Thanks in advance.

My System SpecsSystem Spec
Old 06-01-2008   #2 (permalink)
urkec


 
 

RE: Vbscript calling DTS package

"research_stuff" wrote:
Quote:

> Hi,
>
> I need to call a DTS package from a vbscript. The vbscript can not use
> xp_cmdshell to call the DTS package. The vbscript would be scheduled
> and executed on the server.
>
> Is there a resource that I can be pointed to for the information?
>
>
> Thanks in advance.
>

You can manipulate DTS packages from VBScript using DTS object model:

http://msdn.microsoft.com/en-us/libr...5(SQL.80).aspx


Const TrustedConn = 256

Set objPackage = CreateObject _
("DTS.Package2")

objPackage.LoadFromSQLServer _
"(local)", , , TrustedConn, , , , "PackageName"

objPackage.Execute


But if you just need to run the package, it is simpler to use Dtsrun.exe:

http://msdn.microsoft.com/en-us/libr...7(SQL.80).aspx


--
urkec

My System SpecsSystem Spec
Old 06-01-2008   #3 (permalink)
hb21l6


 
 

Re: Vbscript calling DTS package


"research_stuff" <learnstuff1@xxxxxx> wrote in message
news:5c163158-7c4c-4580-844a-512f99c05ee2@xxxxxx
Quote:

> Hi,
>
> I need to call a DTS package from a vbscript. The vbscript can not use
> xp_cmdshell to call the DTS package. The vbscript would be scheduled
> and executed on the server.
>
> Is there a resource that I can be pointed to for the information?
>
>
> Thanks in advance.
>
this is the one i use in my VBS scripts.


Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1
Const DTSSQLStgFlag_UseTrustedConnection = 256

Set dtsRun = CreateObject("DTS.Package")
dtsRun.LoadFromSQLServer
"MySqlServerMa,e","","",DTSSQLStgFlag_UseTrustedConnection,"","","","MY-DTS-NAME"
dtsRun.Execute()

' some error checking.
DTSresult = True
For Each dtsStage In dtsRun.Steps

If dtsStage.ExecutionResult = DTSStepExecResult_Failure Then
DTSresult = False
Main = DTSTaskExecResult_Failure

if (dtsRun.Tasks(dtsStage.TaskName).Description = "write error
message" OR dtsRun.Tasks(dtsStage.TaskName).Description = "send email") then
DTSResult = True
end if
Else
End If

Next

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Calling a VBScript from Access VB Script
calling WinAPIs from VBScript VB Script
Calling Executable from VBScript VB Script
How to do No hang up VBScript (nohup for VBScript) VB Script
Uninstalling a .msi package Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46