Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Maquis
Starting Member
25 Posts |
Posted - 2005-02-24 : 09:13:46
|
| Is there a way to call a sql job from an asp page? I know you can call a dts package, but we have a job that contains both a dts package and some sql queries/sprocs as steps. Can the job itself be called? Or do you have to call the DTS package, then call the individual queries?Thanks. |
|
|
smithje
Starting Member
32 Posts |
Posted - 2005-03-01 : 18:41:05
|
| Following example shows how we run a stored procedure from an asp page. The page loads with buttons for the users to click on when they want to "import" or "load" data from a spreadsheet that they FTP to our server. When they click the import button it reloads the page and passes the value "Submit" as "Import" The "If" statement then runs the stored procedure "dbo.JS_Scan_CertReg_Import". Likewise if the value of "Submit" is "Load" it runs another stored procedure "dbo.JS_Scan_CertReg_Load" In the import stored procedure we call an externally stored DTS package using the xpcmdshell to read the spreadsheet into a table then display some record count info on the page and if the user is satisfied with the import results they click the "Load" button and data is appended to the live table.<%@LANGUAGE="VBSCRIPT"%><!--#include file="../../../../Connections/connClusterDB.asp" --><% IF request("Submit") <> "" Then IF request("Submit") = "Import" Then set spDDU = Server.CreateObject("ADODB.Command") spDDU.ActiveConnection = MM_connClusterDB_STRING spDDU.CommandText = "dbo.JS_Scan_CertReg_Import" spDDU.Parameters.Append spDDU.CreateParameter("@RETURN_VALUE", 3, 4) spDDU.CommandType = 4 spDDU.CommandTimeout = 120 spDDU.Prepared = true spDDU.Execute() ElseIF request("Submit") = "Load" Then set spDDU = Server.CreateObject("ADODB.Command") spDDU.ActiveConnection = MM_connClusterDB_STRING spDDU.CommandText = "dbo.JS_Scan_CertReg_Load" spDDU.CommandType = 4 spDDU.CommandTimeout = 120 spDDU.Prepared = true spDDU.Parameters.Append spDDU.CreateParameter("RETURN_VALUE", 3, 4) spDDU.Execute() End IF End IF |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2005-03-01 : 18:45:49
|
quote: Originally posted by Maquis Is there a way to call a sql job from an asp page? I know you can call a dts package, but we have a job that contains both a dts package and some sql queries/sprocs as steps. Can the job itself be called? Or do you have to call the DTS package, then call the individual queries?Thanks.
To launch a job, you can call sp_start_job from your application.Tara |
 |
|
|
|
|
|