Solved

How to create a schedule?

Posted on 2003-10-27
5
549 Views
Last Modified: 2008-02-01
I have a table - history
with PK - id, datetime - Lastaccessed

I want to create a sybase event that will automatically delete old history which are 7 days old that will run everyday.
how will i test this if this works?

i tried to use the wizzard but it doest work when i try to change the date&time.

btw, im using sybase ADAnywhere.

can you give me a script? and to test if it works. thanx
0
Comment
Question by:Jerry_Pang
  • 3
  • 2
5 Comments
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 9631255
delete MyTable
where datediff( day, last_accessed, getdate() ) > 7

or

delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()

HTH

Namasi Navaretnam

0
 
LVL 9

Author Comment

by:Jerry_Pang
ID: 9631778
i mean
howto,
create event eventname as {
everyday at 01:00

delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()
}
0
 
LVL 15

Accepted Solution

by:
namasi_navaretnam earned 125 total points
ID: 9633277
Jerry,

CREATE EVENT DailyDelete
SCHEDULE DailyDelete
START TIME '1:00AM' EVERY 24 HOURS
HANDLER
   BEGIN
      delete MyTable
     where dateadd( day, 7, last_accessed ) < getdate()
   END

HTH
Namasi
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 9655422
DId this help?
0
 
LVL 9

Author Comment

by:Jerry_Pang
ID: 9655580
yep. i forgot.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

705 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

20 Experts available now in Live!

Get 1:1 Help Now