Solved

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

Posted on 2004-08-05
12
330 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Button to go back 3 39
JQuery Autocomplete Tag AJAX (Need nice script) 11 57
Want an individual results display div 8 42
Hide and Unhide Table 6 25
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

756 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