Solved

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

Posted on 2004-08-05
12
323 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 

Author Comment

by:Chris_Granger
Comment Utility
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
Comment Utility
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
Comment Utility
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 13

Assisted Solution

by:TommyTupa
TommyTupa earned 100 total points
Comment Utility
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
Comment Utility
@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
Comment Utility
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
Comment Utility
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
Comment Utility
>>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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now