Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute SQL package from ASP

Status
Not open for further replies.

Albano

Instructor
Dec 11, 2000
221
PT
Hi,

I'm trying to execute a SQL package from ASP, and i found this code from Microsoft, sameane knows what is the problem, because it result in the fallwoing error:

Step [Create Table VIEW_DetalheViatura Step] failed
Task "Create Table VIEW_DetalheViatura Task"

Step [Copy Data from VIEW_DetalheViatura to VIEW_DetalheViatura Step] failed
Task "Copy Data from VIEW_DetalheViatura to VIEW_DetalheViatura Task"

Package [Pckg_ListingGlobal] failed

Done


Or someane knows a better way to execute the SQL package.

ASP execute SQL Package Code:

<%@Language=VBScript %>
<% Option Explicit %>
<html>
<head>
<title>Q252987 Sample Code</title>
</head>
<body>

<%
Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1

Dim oPkg, oStep, sMessage, bStatus

Set oPkg = Server.CreateObject("DTS.Package")
oPkg.LoadFromSQLServer "GE9AL1WN2K01","sa","sa",DTSSQLStgFlag_Default,"PackagePassword","","","PcKg_ListingGlobal"
oPkg.Execute()

bStatus = True

For Each oStep In oPkg.Steps
sMessage = sMessage & "<p> Step [" & oStep.Name & "] "
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
sMessage = sMessage & " failed<br>"
bStatus = False
Else
sMessage = sMessage & " succeeded<br>"
End If
sMessage = sMessage & "Task """ & oPkg.Tasks(oStep.TaskName).Description & """</p>"
Next

If bStatus Then
sMessage = sMessage & "<p>Package [" & oPkg.Name & "] succeeded</p>"
Else
sMessage = sMessage & "<p>Package [" & oPkg.Name & "] failed</p>"
End If

Response.Write sMessage
Response.Write "<p>Done</p>"

%>
</body>
</html>


Thanks

Albano
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top