Solved

How to create a schedule?

Posted on 2003-10-27
5
568 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sybase memory in corresponds to sybase pagesize 4 1,325
installing Sybase IQ express edition 15.4 16 878
Linked Server to connect using Advantage OLEDB from MS SQL 18 2,229
SQL Syntax 10 70
Troubleshooting common task sequence error codes
When we purchase storage, we typically are advertised storage of 500GB, 1TB, 2TB and so on. However, when you actually install it into your computer, your 500GB HDD will actually show up as 465GB. Why? It has to do with the way people and computers…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

10 Experts available now in Live!

Get 1:1 Help Now