Link to home
Start Free TrialLog in
Avatar of Jerry_Pang
Jerry_Pang

asked on

How to create a schedule?

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
Avatar of namasi_navaretnam
namasi_navaretnam
Flag of United States of America image

delete MyTable
where datediff( day, last_accessed, getdate() ) > 7

or

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

HTH

Namasi Navaretnam

Avatar of Jerry_Pang
Jerry_Pang

ASKER

i mean
howto,
create event eventname as {
everyday at 01:00

delete MyTable
where dateadd( day, 7, last_accessed ) < getdate()
}
ASKER CERTIFIED SOLUTION
Avatar of namasi_navaretnam
namasi_navaretnam
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
DId this help?
yep. i forgot.