Solved

How to trigger an asp script once a day that does operations on sql server

Posted on 2004-08-05
12
329 Views
Last Modified: 2006-11-17
Hi,

I have an asp page that I'd like to trigger once a day to run updates on SQL server, what is the most desireable method of doing this. The sql server and asp are hosted on a shared server so I don't have full access to all of iis, etc.

Thanks
0
Comment
Question by:Chris_Granger
12 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11729376
Ordinarily this is best done with a pure server-side approach. Otherwise, your page would have to stay open in a browser all of the time....

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11729383
So, what would happen in that case is that the page would refresh every so often, and if the time falls in a certain range, it would execute your code. That does sound like quite an awkward way to do things. Wrong tool for the job?

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11729392
Now what you could do is to create a page that does all of these things with a link that is not available to your users. You could then use a scheduler on your client machine to invoke the page for you.

FtB
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:Chris_Granger
ID: 11729423
Oh no, I didn't mean that. I thought there may be some technique that triggers this sort of thing. It really just mainly running SQL queries. Do you think I should re-open this in the sql server section, I'm sure there's something sql does like that?
0
 
LVL 15

Assisted Solution

by:joeposter649
joeposter649 earned 100 total points
ID: 11729436
Can you try something like this...
http://www.asp101.com/articles/john/schedule/default.asp

"Otherwise, your page would have to stay open in a browser all of the time...."

I'm sure you could do something like this with IE. on your local machine...
http://devguru.com/Technologies/wsh/quickref/wshshell_Run.html
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11729480
In regard to the first link, that is pretty much what I said above, as for the second that is what I meant by running it from the client side.

@Chris_Granger--

That is a much better approach if it can be done. I am not sure about triggers based on time in SQL Server.

FtB
0
 
LVL 13

Assisted Solution

by:TommyTupa
TommyTupa earned 100 total points
ID: 11729488
I've done this by executing my asp as a vbs file. See here:http://www.aspfaq.com/show.asp?id=2143
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11729577
@TommyTupa--

But that requires access to the server that Chris_Granger says he doesn't have.

FtB
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 100 total points
ID: 11729597
However, the ASP FAQ article TommyTupa references does indicate that you can schedule jobs within SQL Server:

http://www.aspfaq.com/show.asp?id=2403

FtB
0
 
LVL 6

Expert Comment

by:casstd
ID: 11732253
Hi,

          As TommyTupa said i have done the same thing for receiving one eamil on a day at a particular time.

1. store this file as Query.vbs

<%@ LANGUAGE=VBSCRIPT %>
<!--#include file="ADOVBS.INC"-->
<!--#include file="dbcon.asp"-->
<%


       'Write stored Procedure is the best method and call the stored procedure
        Qry= "sp_Title "                     'your stored procedure name

       or
         Qry = "select * from tbl"
       Set Rs = DbObjmembers.Execute(Qry)
       
          'clear your recordset object
%>

2. Go to server control pannel and look for Shcheduled task and click Add Scheduled Task

3. Thats's all and test whether the qyery is executed or not.

Hope this will helpful to you.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11732314
>>2. Go to server control pannel and look for Shcheduled task and click Add Scheduled Task<<

The question states:

The sql server and asp are hosted on a shared server so I don't have full access to all of iis, etc

FtB
0
 
LVL 10

Assisted Solution

by:thefritterfatboy
thefritterfatboy earned 200 total points
ID: 11733804
Set up a stored procedure to do what you wish to do daily, then call SQL server's sp_update_jobschedule SPROC to set the interval.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ua-uz_9het.asp

Using a freq_type value of 4 will set the stored procedure to run daily with no access to the SQL server needed in EM.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Calculating value of records from a column - classic asp 7 87
Using querystring in a hyperlink 3 55
If condition on Html with Asp 11 27
Syntax for query to update table 2 29
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question