How execute DTS from a ASP
- From: "Milani Omar" <omar@xxxxxx>
- Date: Wed, 22 Feb 2006 00:09:58 +0100
Hello,
I have found the script that allow to execute the DTS from asp but I have a
qeston
It is possible to execute the script from a ASP page that is on a IIS on a
different server of SQL server?
If yes How?
folowing is the ASP script that I have found
<%@Language=VBScript %>
<% ' 207
Option Explicit
Response.Buffer = False
%>
<%
Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1
Dim oPkg, oStep, sErr, bSuccess
Dim sServer, iSecurity, sUID, sPWD, sPkgName, sPkgPWD
' Get Form Variables
sServer = Request.Form("txtServer")
iSecurity = CInt("0" & Request.Form("optSecurity"))
sUID = Request.Form("txtUID")
sPWD = Request.Form("txtPWD")
sPkgName = Request.Form("txtPkgName")
sPkgPWD = Request.Form("txtPkgPWD")
' Validate Variables
If Len(sServer) = 0 Then sErr = "<li>Invalid Server Name"
If iSecurity = 0 And Len(sUID) = 0 Then _
sErr = sErr & "<li>Invalid Username for SQL Security"
If Len(sPkgName) = 0 Then sErr = sErr & "<li>Invalid Package Name"
If Len(sErr) = 0 Then
Response.Write "<p>Executing " & sPkgName & " from " & _
sServer & "</p>"
' Load the Package Set
oPkg = Server.CreateObject("DTS.Package")
oPkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity , sPkgPWD, "", "",
sPkgName
' Execute the Package
oPkg.Execute
bSuccess = True
' Report Step status
For Each oStep In oPkg.Steps
sErr = sErr & "<p> Step [" & oStep.Name & "] "
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
sErr = sErr & " failed<br>"
bSuccess = False
Else
sErr = sErr & " succeeded<br>"
End If
sErr = sErr & "Task """ & _
oPkg.Tasks(oStep.TaskName).Description & """</p>"
Next
If bSuccess Then
sErr = sErr & "<p>Package [" & oPkg.Name & "] succeeded</p>"
Else
sErr = sErr & "<p>Package [" & oPkg.Name & "] failed</p>"
End If
End If
' Clean Up
oPkg.UnInitialize
Set oStep = Nothing
Set oPkg = Nothing
Response.Write sErr
Response.Write "<p>Done</p>"
%>
thank you
Milani Omar
.
- Prev by Date: SSIS import db not able to connect
- Next by Date: Re: SSIS and Staging Tables
- Previous by thread: SSIS import db not able to connect
- Next by thread: Re: SSIS Package execution failed
- Index(es):
Relevant Pages
|